require_bearer_token

Function require_bearer_token 

Source
pub async fn require_bearer_token(
    __arg0: State<Arc<Config>>,
    request: Request<Body>,
    next: Next,
) -> Result<Response, Response>
Expand description

Axum middleware enforcing optional bearer-token auth on protected routes.

If no token is configured the request passes through unchanged. If a token is configured, the Authorization: Bearer <token> header must match exactly (constant-time compare) or the request is rejected with 401, in the same {"error", "code"} envelope as every other failure (#5750).