Expand description
Request guards — composable preconditions evaluated before a handler runs.
Guards operate on RequestContext and return Error on rejection.
Apply manually at the top of a handler:
ⓘ
BearerAuth::new("secret").check(&ctx)?;Re-exports§
pub use crate::resilience::rate_limit::RateLimit;
Structs§
- Bearer
Auth - Minimal
Authorization: Bearer <token>guard. Comparison is constant-time. - JwtAuth
Guard - Checks that the incoming request carried a valid JWT.
- Role
Guard - Checks that the authenticated principal’s
"role"claim matches a required value. - Session
Auth Guard - Passes if the request has a loaded server-side session.
Statics§
- JWT_
AUTH - Ready-to-use singleton for
JwtAuthGuard. Import and call: - SESSION_
AUTH - Ready-to-use singleton for
SessionAuthGuard.