Skip to main content

Module axum

Module axum 

Source
Expand description

Axum middleware for HTTP authentication Axum middleware for HTTP authentication

Provides authentication middleware for Axum HTTP services that:

  1. Extracts request parts (headers, method, URI)
  2. Validates using configured AuthProvider
  3. Injects AuthContext into request extensions
  4. Returns 401 Unauthorized on invalid credentials, 503 Service Unavailable when a provider’s backing store is unreachable

Structs§

AuthRejection
A provider rejection with the request details needed to log it later.

Enums§

AuthError
Authentication errors for HTTP responses
QuietAuthError
Failure of authenticate_quiet.

Functions§

auth_middleware
Axum middleware for request-based authentication
authenticate
Validates req, logs a rejection, strips the spoofable x-auth-* headers and inserts the AuthContext on success.
authenticate_quiet
Same as authenticate but hands a rejection back instead of logging it, so a caller can fold extra detail into a single warning.