fastapi_aad_auth._base.validators.token

Base validator for token based authentication.

class fastapi_aad_auth._base.validators.token.InitOAuth(**kwargs)[source]

OAuth information for openapi docs.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

class fastapi_aad_auth._base.validators.token.OAuthFlowType(value)

Enumeration of OAuth Flows for OpenAPI

Options:
  • implicit

  • password

  • clientCredentials

  • authorizationCode

class fastapi_aad_auth._base.validators.token.TokenValidator(client_id: str, authorizationUrl: str, tokenUrl: str, api_audience: typing.Optional[str] = None, scheme_name: typing.Optional[str] = None, scopes: typing.Optional[dict] = None, auto_error: bool = False, enabled: bool = True, use_pkce: bool = True, user_klass: type = <class 'fastapi_aad_auth._base.state.User'>, flow_type: fastapi_aad_auth._base.validators.token.OAuthFlowType = OAuthFlowType.authorizationCode)[source]

Validator for token based authentication.

Initialise validator for token based authentication.

check(request: starlette.requests.Request)[source]

Check the authentication from the request.

get_token(request: starlette.requests.Request)[source]

Get the token from the request.

property init_oauth

Get the openapi docs config.

validate_token(token, options=None)[source]

Validate provided token.