fastapi_aad_auth._base.state

Authentication State Handler.

class fastapi_aad_auth._base.state.AuthenticationOptions(value)[source]

Authentication Options.

class fastapi_aad_auth._base.state.AuthenticationState(**kwargs)[source]

Authentication State.

Initialise the logger.

classmethod as_unauthenticated(serializer, session)[source]

Store as an un-authenticated user.

classmethod authenticate_as(user, serializer, session)[source]

Store the authenticated user.

property authenticated_user

Get the authenticated user.

check_groups(required_groups: Optional[Union[List[str], str]] = None)[source]

Check if the user has the required roles.

check_roles(required_roles: Optional[Union[List[str], str]] = None)[source]

Check if the user has the required roles.

check_scopes(required_scopes: Optional[Union[List[str], str]] = None)[source]

Check if the user has the required scopes.

check_session_state(session_state)[source]

Check state against session state.

property credentials

Get the credentials object.

is_authenticated()[source]

Check if the state is authenticated.

classmethod load(serializer: itsdangerous.url_safe.URLSafeSerializer, encoded_state: Optional[str] = None)[source]

Load from encoded state.

Parameters

serializer -- Serializer object containing the en/decoding secrets

Keyword Arguments

encoded_state -- The encoded state to be decoded

classmethod load_from_session(serializer: itsdangerous.url_safe.URLSafeSerializer, session)[source]

Load from a session.

classmethod logout(serializer: itsdangerous.url_safe.URLSafeSerializer, session)[source]

Clear the sessions state.

save_to_session(serializer: itsdangerous.url_safe.URLSafeSerializer, session)[source]

Save to a session.

store(serializer)[source]

Store in serializer.

class fastapi_aad_auth._base.state.InteractiveUser(username: str, name: str, email: str, roles: Optional[List[str]] = None, groups: Optional[List[str]] = None, scopes: Optional[List[str]] = None)[source]

User for interactive components through Starlette.

Initialise the user.

class fastapi_aad_auth._base.state.User(**kwargs)[source]

User Model.

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.

property klass

Return the user klass information for loading from a session.

property permissions

User Permissions.