Skip to main content

auth_middleware

Function auth_middleware 

Source
pub async fn auth_middleware(
    __arg0: State<AppState>,
    req: Request<Body>,
    next: Next,
) -> Result<Response, ApiErrorResponse>
Expand description

Axum middleware that validates the Authorization: Bearer <token> header.

Requests to health-check paths pass through without authentication. All other requests must present a valid Bearer token that matches state.bearer_token (compared in constant time).