wuttafarm.auth¶
Auth handler for use with farmOS
- class wuttafarm.auth.WuttaFarmAuthHandler(config)[source]¶
Custom auth handler for WuttaFarm. This adds some magic around the user login process.
It can attempt authentication against the configured farmOS instance, auto-creating native users within the app DB as needed.
- authenticate_user(session, username, password)[source]¶
When authentication is attempted, this first will check credentials against the app DB per normal logic. If that succeeds, the result is no different from the typical behavior.
If default logic fails, this will try to obtain an OAuth2 token from the farmOS site. If that succeeds, then a lookup is done in the app DB for a matching user. If the user does not yet exist it will be created automatically.