Expand description
Authentication module for Trustee API.
Uses PEP for OIDC/OAuth2:
ResourceServerClientfor JWT validation (offline, cached JWKS)OidcClientfor authorization code + PKCE login flowPkceCookieManagerfor stateless PKCE state (HMAC-signed cookies)DevConfigfor local development bypass
Two deployment modes:
- Standalone: browser hits /auth/login → IdP redirect → /auth/callback → cookie
- Centralized: external auth app sends
Authorization: Bearer <token>directly
Token extraction order: Authorization: Bearer header → trustee_token cookie.
Structs§
- Auth
Config - Authentication configuration parsed from
[oidc]and[dev]TOML sections. - Auth
State - Shared authentication state, stored in ServerState.
- Auth
User - Authenticated user info extracted from the token.
- Callback
Query - Query parameters for OIDC callback.
- McpCallback
Query - Query parameters for MCP OIDC callback.
- McpLogin
Query - Query parameters for MCP login initiation.
Enums§
- Auth
Error - Authentication errors.
Functions§
- auth_
routes - Build the auth routes as a nested Router.
- check_
auth - Check authentication for a protected endpoint.