djblets.webapi.auth.backends¶
Base support for managing API authentication backends.
These functions allow for fetching the list of available API authentication backend classes, and using them to perform an authentication based on an HTTP request.
- get_auth_backends() List[Type[WebAPIAuthBackend]] [source]¶
Return the list of web API authentication backends.
This defaults to
WebAPIBasicAuthBackend
, for HTTP Basic Auth, but can be overridden by settingsettings.WEB_API_AUTH_BACKENDS
to a list of class paths.- Returns:
A list of all usable authentication backend classes.
- Return type:
- reset_auth_backends()[source]¶
Reset the list of authentication backends.
The list will be recomputed the next time an authentication backend needs to be used.
- check_login(request: HttpRequest) Optional[Tuple[bool, Optional[str], Optional[Dict[str, str]]]] [source]¶
Check if a login request was made.
If the client specifies a
HTTP_AUTHORIZATION
header, this will attempt to authenticate using a supported authentication method.- Parameters:
request (
HttpRequest
) – The HTTP request from the client.- Returns:
The result of the authentication, if successful, or
None
otherwise.See
WebAPIAuthenticateResult
for details on the format for the returned type value.- Return type: