simple_openid_connect.integrations.djangorestframework.authentication#

DRF Authentication classes

See the DRF documentation on Setting the authentication scheme about how to use the classes contained here.

Classes

AccessTokenAuthentication()

An authentication scheme that interprets Authorization: Bearer ... http headers as access tokens.

AuthenticatedViaToken(token, user_data)

A marker that is attached as request.auth on successful authentication and which holds well formatted information about that authentication.

class simple_openid_connect.integrations.djangorestframework.authentication.AccessTokenAuthentication#

An authentication scheme that interprets Authorization: Bearer ... http headers as access tokens.

authenticate(request: HttpRequest) Tuple[Any, AuthenticatedViaToken] | None#

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

authenticate_header(request: HttpRequest) str#

Return a string to be used as the value of the WWW-Authenticate header in a 401 Unauthenticated response, or None if the authentication scheme should return 403 Permission Denied responses.

class simple_openid_connect.integrations.djangorestframework.authentication.AuthenticatedViaToken(token: str, user_data: IdToken | UserinfoSuccessResponse | TokenIntrospectionSuccessResponse | JwtAccessToken)#

A marker that is attached as request.auth on successful authentication and which holds well formatted information about that authentication.

__init__(token: str, user_data: IdToken | UserinfoSuccessResponse | TokenIntrospectionSuccessResponse | JwtAccessToken)#