fastapi_aad_auth._base.backend

Base OAuthBackend with token and session validators.

class fastapi_aad_auth._base.backend.BaseOAuthBackend(validators: List[fastapi_aad_auth._base.validators.base.Validator], enabled: bool = True)[source]

Base OAuthBackend with token and session validators.

Initialise the validators.

property api_auth_scheme

Get the API Authentication Schema.

DEPRECATED - fastapi_aad_auth._base.backend:BaseOAuthBackend.api_auth_scheme will be deprecated in version 0.2.0, and is replaced by fastapi_aad_auth._base.backend:BaseOAuthBackend.requires_auth

async authenticate(request)[source]

Authenticate a request.

Required by starlette authentication middleware

check(request: starlette.requests.Request, allow_session=True) Optional[fastapi_aad_auth._base.state.AuthenticationState][source]

Check/validate a request.

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

Check if a request is authenticated.

requires_auth(scopes: str = 'authenticated', allow_session: bool = False, roles: Optional[Union[List[str], str]] = None, groups: Optional[Union[List[str], str]] = None)[source]

Require authentication, use with fastapi Depends.