Skip to main content

jwt_middleware_with_revocation

Function jwt_middleware_with_revocation 

Source
pub fn jwt_middleware_with_revocation(
    handler: Arc<dyn IAuthenticationHandler>,
    session_store: Arc<dyn ISessionStore>,
) -> impl IMiddleware
Expand description

Create a JWT authentication middleware that also rejects revoked tokens.

After the signature check, the token’s jti is looked up in session_store; a revoked token is answered with the framework’s 401 (problem+json + WWW-Authenticate) before the endpoint runs. Tokens without a jti pass through unchanged.

Advanced entry point — only for a hand-assembled middleware pipeline. A regular host enables revocation with HostBuilder::use_session_store, which registers the store and wires this middleware itself.