pub trait Revocation: Send + Sync {
// Required method
fn is_revoked(
&self,
jti: &str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + '_>>;
}Expand description
Optional trait for JWT token revocation checks.
Implement this against your storage backend (DB, Redis, LruCache, etc.).
Register with JwtLayer::with_revocation() —
the middleware skips the check when no backend is registered.
§Behavior
- Only called when a revocation backend is registered AND the token has a
jticlaim. - Token without
jti+ registered backend: accepted without callingis_revoked. Ok(true): token rejected withjwt:revoked.Ok(false): token accepted.Err(_): token rejected withjwt:revocation_check_failed(fail-closed).