admin_auth_middleware

Function admin_auth_middleware 

Source
pub async fn admin_auth_middleware(
    state: State<AppState>,
    request: Request<Body>,
    next: Next,
) -> Response
Expand description

Axum middleware that enforces admin authentication via Basic Auth.

Authentication is bypasses if:

  1. auth.enabled = false (dev mode)
  2. auth.admin_password_hash is not configured

Otherwise, expects “Authorization: Basic <base64>” header.