fastapi_aad_auth.oauth.aad

AAD handlers.

DEPRECATED - fastapi_aad_auth.oauth.aad will be deprecated in version 0.2.0, and is replaced by fastapi_aad_auth.providers.aad and fastapi_aad_auth.auth

class fastapi_aad_auth.oauth.aad.AADOAuthBackend(session_validator: fastapi_aad_auth._base.validators.session.SessionValidator, client_id: str, tenant_id: str, prompt: typing.Optional[str] = None, client_secret: typing.Optional[str] = None, scopes: typing.Optional[typing.List[str]] = None, enabled: bool = True, client_app_ids: typing.Optional[typing.List[str]] = None, strict_token: bool = True, api_audience: typing.Optional[str] = None, redirect_uri: typing.Optional[str] = None, domain_hint: typing.Optional[str] = None, user_klass: type = <class 'fastapi_aad_auth._base.state.User'>, oauth_base_route: str = '/oauth', token_type: typing.Union[str, fastapi_aad_auth.providers.aad.TokenType] = TokenType.access, token_scopes: typing.Optional[typing.Dict[str, str]] = None, flow_type: fastapi_aad_auth._base.validators.token.OAuthFlowType = OAuthFlowType.authorizationCode, roles: typing.Optional[typing.List[str]] = None, jwks_cache_ttl: int = 0)[source]

fastapi auth backend for Azure Active Directory.

DEPRECATED - fastapi_aad_auth.oauth.aad:AADOAuthBackend will be deprecated in version 0.2.0, and is replaced by fastapi_aad_auth.providers.aad:AADProvider

Initialise the auth backend.

Args:
  • session_serializer: Session serializer object

  • client_id: Client ID from Azure App Registration

  • tenant_id: Tenant ID to connect to for Azure App Registration

Keyword Args:
  • prompt: Prompt options for Azure AD

  • client_secret: Client secret value

  • scopes: Additional scopes requested

  • enabled: Boolean flag to enable this backend

  • client_app_ids: List of client apps to accept tokens from

  • strict_token: Strictly evaluate token

  • api_audience: Api Audience declared in Azure AD App registration

  • redirect_uri: Full URI for post authentication callbacks

  • domain_hint: Hint for the domain

  • user_klass: Class to use as a user.

  • flows: Customise the OAuth2 Flows in the OpenAPI docs

DEPRECATED - fastapi_aad_auth.oauth.aad:AADOAuthBackend will be deprecated in version 0.2.0, and is replaced by fastapi_aad_auth.providers.aad:AADProvider

classmethod from_config(config: fastapi_aad_auth.config.Config)[source]

Load the auth backend from a config.

Args:

config: Loaded configuration

Keyword Args:

user_klass: The class to use as a user

DEPRECATED - fastapi_aad_auth.oauth.aad:AADOAuthBackend.from_config will be deprecated in version 0.2.0, and is replaced by fastapi_aad_auth.providers.aad:AADProvider.from_config and fastapi_aad_auth.auth:Authenticator