Skip to main content

basic_auth_middleware

Function basic_auth_middleware 

Source
pub async fn basic_auth_middleware(
    __arg0: State<Arc<AuthState>>,
    req: Request<Body>,
    next: Next,
) -> Response
Expand description

Axum middleware enforcing HTTP Basic Auth on admin endpoints.

/healthz and /readyz bypass authentication so orchestrators can probe them without credentials. Every other request must carry an Authorization: Basic <base64(user:pass)> header matching AuthState; otherwise the middleware responds 401 Unauthorized with a WWW-Authenticate: Basic realm="featherbit admin" challenge and the inner handler is never invoked.