akvo.rest.authentication module

class akvo.rest.authentication.JWTAuthentication[source]

Bases: BaseAuthentication

authenticate(request: Request)[source]

Authenticate the request and return a two-tuple of (user, token).

authenticate_credentials(token)[source]
class akvo.rest.authentication.TastyTokenAuthentication[source]

Bases: TokenAuthentication

Override the model attribute to use Tastypie’s token model

Simple token based authentication.

Clients should authenticate by passing the token key in the “Authorization” HTTP header, prepended with the string “Token “. For example:

Authorization: Token 401f7ac837da42b97f613d789819ff93537bee6a

model

A custom token model may be used, but must have the following properties.

  • key – The string identifying the token

  • user – The user to which the token belongs

alias of ApiKey

akvo.rest.authentication.create_api_key(sender, **kwargs)[source]

A signal for hooking up automatic ApiKey creation. Slightly modified from the tastypie function to generate a key when saving an existing user if no key exists