Built-in authenticators¶
Reference for the async-aware DRF parity authenticators. See the Built-in authenticators guide for behavioural notes and worked examples.
BaseAuthentication ¶
Bases: BaseAuthentication
All authentication classes should extend BaseAuthentication. Adds an async aauthenticate hook that defaults to running the sync authenticate in a thread.
aauthenticate
async
¶
Returns a (user, auth) tuple or None for the given request.
BasicAuthentication ¶
Bases: BaseAuthentication, BasicAuthentication
HTTP Basic authentication against username and password. Adds an async surface that resolves credentials via django.contrib.auth.aauthenticate.
SessionAuthentication ¶
Bases: BaseAuthentication, SessionAuthentication
Use Django's session framework for authentication. Adds an async surface that prefers request._request.auser when available and runs the CSRF check off the event loop.
aauthenticate
async
¶
Returns a (user, None) tuple from the session, or None when no active user is present.
TokenAuthentication ¶
Bases: BaseAuthentication, TokenAuthentication
Simple token based authentication. Clients should authenticate by passing the token key in the "Authorization" HTTP header, prepended with the string "Token ". Adds an async surface that resolves the token via async ORM.
RemoteUserAuthentication ¶
Bases: BaseAuthentication, RemoteUserAuthentication
REMOTE_USER authentication. Maps the value at request.META[header] to a User via the configured Django auth backend. Adds an async surface using django.contrib.auth.aauthenticate.
aauthenticate
async
¶
Returns a (user, None) tuple from the configured remote-user header, or None when no active user is resolved.