Skip to main content

Module auth

Module auth 

Source
Expand description

JWT authentication and authorization. JWT authentication middleware and token management.

Structs§

AuthenticatedAgent
Claims
JWT claims embedded in every token.
TokenRequest
Request body for the token generation endpoint.
TokenVerifier
How bearer tokens are checked.

Functions§

admin_authorized
Authorize an admin request from request headers against the configured admin key. Errors if no admin key is configured (admin endpoints are disabled) or the provided x-api-key / bearer does not match. Used by the /v1/admin endpoints.
auth_middleware
Middleware that enforces JWT auth when a secret is configured.
create_scoped_token
Create a signed JWT limited to dbs (all when None).
create_token
Create a signed JWT for the given agent.
generate_token