lomas_server.auth package

Submodules

lomas_server.auth.auth module

class lomas_server.auth.auth.FreePassAuthenticator(*, authentication_type: Literal[AuthenticationType.FREE_PASS])[source]

Bases: BaseModel

Authenticator that Bypass Auth.

authentication_type: Literal[AuthenticationType.FREE_PASS]
model_config: ClassVar[ConfigDict] = {}

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

class lomas_server.auth.auth.JWTAuthenticator(*, authentication_type: Literal[AuthenticationType.JWT], keycloak_url: HttpUrl, realm: str)[source]

Bases: BaseModel

Authenticator that identifies users by validating the provided JWT token.

authentication_type: Literal[AuthenticationType.JWT]

The keycloak address for this app instance.

property jwk_client: PyJWKClient[source]

Initializes instance PyJWKClient with caching.

keycloak_url: HttpUrl

The realm name for this app instance.

Type:

Realm

model_config: ClassVar[ConfigDict] = {}

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

realm: str
lomas_server.auth.auth.get_user_id(authenticator: Annotated[FreePassAuthenticator | JWTAuthenticator, FieldInfo(annotation=NoneType, required=True, discriminator='authentication_type')], security_scopes: SecurityScopes, auth_creds: HTTPAuthorizationCredentials) UserId[source]

Extracts user id from bearer token.

Parameters:
  • security_scopes (SecurityScopes) – The required scopes for the endpoint.

  • auth_creds (HTTPAuthorizationCredentials) – Authorization credentials.

Returns:

The UserId object containing user infos.

Return type:

UserId

Module contents