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
|
An authentication scheme that interprets |
An authentication scheme that overwrites the default behavior of |
|
|
A marker that is attached as |
- class simple_openid_connect.integrations.djangorestframework.authentication.AccessTokenAuthentication(allow_anonymous: Optional[bool] = True)#
An authentication scheme that interprets
Authorization: Bearer ...http headers as access tokens and validates by using the Openid providers token introspection capabilities.By default, this may confirm that a request is authenticated and has appropriate access while not identifying a user. In that case, only an
AnonymousUserinstance is set on the request. If this is not desired, either set theallow_anonymousconstructor parameter toFalseor use theAccessTokenNoAnonAuthenticationauthentication class.- __init__(allow_anonymous: Optional[bool] = True)#
- Parameters
allow_anonymous – Whether access is allowed when the token is valid but no user can be identified. This is the case if the Openid providers token introspection endpoint does not return a user id.
- authenticate(request: HttpRequest) Optional[Tuple[Any, AuthenticatedViaToken]]#
Authenticate the request and return a two-tuple of (user, token).
- class simple_openid_connect.integrations.djangorestframework.authentication.AccessTokenNoAnonAuthentication(allow_anonymous: Optional[bool] = False)#
An authentication scheme that overwrites the default behavior of
AccessTokenAuthenticationso that tokens are only considered valid if a user can be uniquely identified.
- class simple_openid_connect.integrations.djangorestframework.authentication.AuthenticatedViaToken(token: str, token_introspection: TokenIntrospectionSuccessResponse)#
A marker that is attached as
request.authon successful authentication and which holds well formatted information about that authentication.- __init__(token: str, token_introspection: TokenIntrospectionSuccessResponse)#