fmn.api.auth module

class fmn.api.auth.Identity(*, name: str, admin: bool, expires_at: float, user_info: dict[str, Any])[source]

Bases: BaseModel

admin: bool
classmethod client() AsyncClient[source]
expires_at: float
async classmethod from_oidc_token(token: str) Identity[source]
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'ignore'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'admin': FieldInfo(annotation=bool, required=True), 'expires_at': FieldInfo(annotation=float, required=True), 'name': FieldInfo(annotation=str, required=True), 'user_info': FieldInfo(annotation=dict[str, Any], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(__context: Any) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • __context – The context.

name: str
user_info: dict[str, Any]
class fmn.api.auth.IdentityFactory(optional=False)[source]

Bases: object

async process_oidc_auth(creds: HTTPAuthorizationCredentials | None) Identity | None[source]
exception fmn.api.auth.TokenExpired[source]

Bases: ValueError

async fmn.api.auth.get_identity_admin(identity: Identity = Depends(IdentityFactory))[source]