Skip to main content

apply

Function apply 

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

Axum middleware closure that rejects unauthenticated requests with 401 Unauthorized + WWW-Authenticate: Bearer and a JSON envelope.

Wired into the per-router builder via axum::middleware::from_fn_with_state(Arc::new(gate), apply). The gate is shared (Arc) so all routes on a router observe the same configuration.