Skip to main content

require_auth

Function require_auth 

Source
pub async fn require_auth(
    __arg0: State<ServerState>,
    req: Request,
    next: Next,
) -> Result<Response, ServeError>
Available on crate feature serve only.
Expand description

Axum middleware enforcing bearer auth on /v1/*. A no-op when the server was started with --no-auth. CORS preflight (OPTIONS) is allowed through so browsers (which omit Authorization on preflight) work behind a CORS policy.