Jump to >

reviewboard.webapi.auth_backends

class TokenAuthBackend[source]

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 reviewboard.webapi.models.WebAPIToken

class OAuth2TokenAuthBackend[source]

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
Returns

Whether or not the authentication request is valid.

Return type

bool

class WebAPIBasicAuthBackend[source]

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

dict