reviewboard.webapi.auth_backends¶
- class TokenAuthBackend[source]¶
Bases:
TokenAuthBackendMixin
,BaseAuthBackend
Authenticates users and their API tokens for API requests.
This will handle authenticating users and their API tokens for API requests. It’s only used for API requests that specify a username and a token.
- api_token_model[source]¶
alias of
WebAPIToken
- __annotations__ = {}¶
- class OAuth2TokenAuthBackend[source]¶
Bases:
OAuth2TokenBackendMixin
,BaseAuthBackend
An OAuth2 token authentication backend that handles local sites.
This is similar to
oauth2_provider.backends.OAuth2Backend
except it ensures the application is enabled and either:not limited to a local site; or
limited to the local site being requested.
- verify_request(request, token, user)[source]¶
Ensure the given authentication request is valid.
This method ensures the following:
The Application being used for authentication is enabled.
The Local Site the Application is associated with matches the Local Site of the current HTTP request.
If the Application is associated with a Local Site that site must be accessible to the user performing the authentication.
- Parameters:
request (
django.http.HttpRequest
) – The current HTTP request.token (
oauth2_provider.models.AccessToken
) – The access token being used for authentication.user (
django.contrib.auth.models.User
) – The user who is authenticating.
- Returns:
Whether or not the authentication request is valid.
- Return type:
- __annotations__ = {}¶
- class WebAPIBasicAuthBackend[source]¶
Bases:
WebAPIBasicAuthBackend
A specialized WebAPI Basic auth backend that supports e-mail addresses.
- get_credentials(request)[source]¶
Return the credentials supplied in the request.
If the user provides an e-mail address as the username credential, it will be translated to a username.
- Parameters:
request (
django.http.HttpRequest
) – The request containing the credentials.- Returns:
A dictionary of the supplied credentials.
- Return type:
- __annotations__ = {}¶