Available on crate feature
serve only.Expand description
Bearer-token authentication + RBAC authorization for /v1/* (#205).
Constant-time comparison via subtle; the Authorization header is the only
accepted credential. The bearer token resolves (via
AuthMode::resolve) to an
AuthContext, the request’s matched route declares the required
Permission, and a role that lacks it is
denied (403) with an audit record.
Functions§
- authorize_
header - Validate a raw
Authorizationheader value against the expected token. - require_
auth - Axum middleware enforcing bearer auth + RBAC on
/v1/*. Under--no-authevery request resolves to an implicitanonymousadmin (all permitted), so the authz path is uniform. CORS preflight (OPTIONS) is allowed through so browsers (which omitAuthorizationon preflight) work behind a CORS policy.