Skip to main content

Module jti_store

Module jti_store 

Source
Expand description

Pluggable JTI revocation / single-use store. The default is in-memory; implement jti_store::JtiStore to back it with Redis or a database when you run more than one instance. Pluggable JTI (JWT ID) revocation / single-use store.

A JtiStore records which JWT ids are spent: revoked at logout, or consumed by a single-use impersonation handoff. A request carrying a spent jti must be rejected, or the token can be replayed until it expires.

Anything the store forgets becomes valid again. A restart or an eviction can drop an entry. A store that is not shared never sees the other processes. In both cases a revoked jti still works until its exp. Use a shared, durable store once you run more than one instance.

  • InMemoryJtiStore — process-local map, the default for every shipped consumer. Good for one instance, dev and tests. mark_used pops expired entries off an expiry heap, so memory stays bounded with no sweeper and no full-map scan.
  • Anything else — implement JtiStore over Redis, a database table, or another shared store. RedisCache is the smallest bridge.

Structs§

InMemoryJtiStore
In-process JTI store. The default for every shipped JWT / handoff consumer. Its entries are lost on restart and not shared with other processes, so a revoked jti can still be replayed there.

Traits§

JtiStore
Storage backend for “this JTI is no longer valid” lookups.

Type Aliases§

JtiFuture
Future returned by the JtiStore methods.