Skip to main content

Module auth_middleware

Module auth_middleware 

Source

Functionsยง

require_auth
A middleware that extracts the PASETO token from the Authorization: Bearer <token> header, validates it, and injects the AuthPayload into the request extensions.
require_role
An extractor guard for RBAC (Role-Based Access Control). Use it to protect routes, e.g., .route_layer(axum::middleware::from_fn(|req, next| require_role(req, next, "admin")))