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.
Modules§
- actions
- Cedar action names (P2, nghr 645809c3).
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.
- Principal
Kind - Principal kind (16D).
Agentiff the enrichedroleclaim contains “agent” — the exact value mapped by Kanidm’spdt-api-agentsgroup (role vocabulary: admin | user | service | agent, facts doc 42977cb7).
Functions§
- auth_
routes - Build the auth routes as a nested Router.
- check_
auth - Check authentication for a protected endpoint.
- check_
dispatch_ admin - 16F: admin gate for the per-agent dispatch surface (
/xagent/{name}).