Skip to main content

require_auth

Function require_auth 

Source
pub async fn require_auth(
    __arg0: State<Arc<AuthState>>,
    request: Request,
    next: Next,
) -> Result<Response, StatusCode>
Expand description

Axum middleware that validates the Authorization: Bearer <token> header against AuthState.

§Errors

Returns StatusCode::UNAUTHORIZED if the token is missing or invalid.