tlc.service.authentication

Module Contents

Classes

Data

Data

Description

DEFAULT_AUTH_TOKEN_MAX_AGE

API

DEFAULT_AUTH_TOKEN_MAX_AGE = 300
class BearerTokenAuthenticationMiddleware(
app: litestar.types.ASGIApp,
exclude: str | list[str] | None = None,
exclude_from_auth_key: str = 'exclude_from_auth',
exclude_http_methods: Sequence[litestar.types.Method] | None = None,
scopes: litestar.types.Scopes | None = None,
)

Bases: litestar.middleware.authentication.AbstractAuthenticationMiddleware

async ensure_bearer_token(
connection: ASGIConnection,
) str
exception TimestampSkewException(
message: str,
server_time: str,
request_time: str,
actual_skew_seconds: float,
allowed_skew_seconds: float,
)

Bases: litestar.exceptions.PermissionDeniedException

Raised when there is a timestamp skew.

Initialize HTTPException.

Set detail and args if not provided.

Args: *args: if detail kwarg not provided, first arg should be error detail. detail: Exception details or message. Will default to args[0] if not provided. status_code: Exception HTTP status code. headers: Headers to set on the response. extra: An extra mapping to attach to the exception.

class TimestampHmacAuthenticationMiddleware(
app: litestar.types.ASGIApp,
exclude: str | list[str] | None = None,
exclude_from_auth_key: str = 'exclude_from_auth',
exclude_http_methods: Sequence[litestar.types.Method] | None = None,
scopes: litestar.types.Scopes | None = None,
)

Bases: tlc.service.authentication.BearerTokenAuthenticationMiddleware

async authenticate_request(
connection: ASGIConnection,
) AuthenticationResult
class JwtAuthenticationMiddleware(
app: litestar.types.ASGIApp,
exclude: str | list[str] | None = None,
exclude_from_auth_key: str = 'exclude_from_auth',
exclude_http_methods: Sequence[litestar.types.Method] | None = None,
scopes: litestar.types.Scopes | None = None,
)

Bases: tlc.service.authentication.BearerTokenAuthenticationMiddleware

async authenticate_request(
connection: ASGIConnection,
) AuthenticationResult
class ActivateJwtOnApiKeyMiddleware

Bases: litestar.middleware.base.ASGIMiddleware

Middleware to activate JWT on API key

async handle(
scope: litestar.types.Scope,
receive: litestar.types.Receive,
send: litestar.types.Send,
next_app: litestar.types.ASGIApp,
) None