Expand description
Axum middleware for HTTP authentication Axum middleware for HTTP authentication
Provides authentication middleware for Axum HTTP services that:
- Extracts request parts (headers, method, URI)
- Validates using configured AuthProvider
- Injects AuthContext into request extensions
- Returns 401 Unauthorized on invalid credentials, 503 Service Unavailable when a provider’s backing store is unreachable
Structs§
- Auth
Rejection - A provider rejection with the request details needed to log it later.
Enums§
- Auth
Error - Authentication errors for HTTP responses
- Quiet
Auth Error - Failure of
authenticate_quiet.
Functions§
- auth_
middleware - Axum middleware for request-based authentication
- authenticate
- Validates
req, logs a rejection, strips the spoofablex-auth-*headers and inserts theAuthContexton success. - authenticate_
quiet - Same as
authenticatebut hands a rejection back instead of logging it, so a caller can fold extra detail into a single warning.