lomas_server.auth package

Submodules

lomas_server.auth.auth module

class lomas_server.auth.auth.FreePassAuthenticator[source]

Bases: UserAuthenticator

Authenticator class that simply extracts user information from.

the provided bearer. ! No verification is performed!

get_user_id(security_scopes: SecurityScopes, auth_creds: HTTPAuthorizationCredentials) UserId[source]

Parses the HTTP bearer token as a json string to construct a UserId.

!Does NOT perform any verification!

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

  • auth_creds (HTTPAuthorizationCredentials) – Authorization credentials.

Returns:

The parsed UserId.

Return type:

UserId

class lomas_server.auth.auth.JWTAuthenticator(keycloak_url: Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)], realm: str)[source]

Bases: UserAuthenticator

Authenticator class that identifies users by validating the provided JWT token.

get_user_id(security_scopes: SecurityScopes, auth_creds: HTTPAuthorizationCredentials) UserId[source]

Parses the JWT bearer token to construct a UserId.

The JWT is verified against the certificates provided by the Id Provider.

! Does not verify scopes yet !

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

  • auth_creds (HTTPAuthorizationCredentials) – Authorization credentials.

Returns:

The parsed UserId.

Return type:

UserId

class lomas_server.auth.auth.UserAuthenticator[source]

Bases: ABC

Abstract base class for providing user authentification methods.

abstract get_user_id(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