pub struct InMemoryRevocationStore { /* private fields */ }Expand description
In-memory revocation store with lazy expiry sweeps. Suitable for single-instance deployments and testing.
Implementations§
Trait Implementations§
Source§impl Default for InMemoryRevocationStore
impl Default for InMemoryRevocationStore
Source§impl RevocationStore for InMemoryRevocationStore
impl RevocationStore for InMemoryRevocationStore
Source§fn sweep_expired(&self, now_s: u64)
fn sweep_expired(&self, now_s: u64)
Reclaim entries past their retention period when the backend needs an
explicit sweep. Distributed stores normally use their native TTL.
Source§fn revoke(&self, jti: &str, expires_at: u64) -> Result<(), String>
fn revoke(&self, jti: &str, expires_at: u64) -> Result<(), String>
Mark a JTI as revoked across issuers for an authorized operator. Holder
requests must use
try_revoke_token. expires_at is the epoch second at which the
entry is last required (the token’s exp plus verifier leeway). An error
means the caller cannot confirm that the write succeeded.Source§fn try_revoke(
&self,
jti: &str,
expires_at: u64,
) -> Result<RevokeOutcome, String>
fn try_revoke( &self, jti: &str, expires_at: u64, ) -> Result<RevokeOutcome, String>
Atomically record a revocation and report whether it is new.
Backends overriding this method can deduplicate audit records.
Source§fn is_revoked(&self, jti: &str) -> Result<bool, String>
fn is_revoked(&self, jti: &str) -> Result<bool, String>
Ok(true) if an operator-wide JTI rule is present. Identity validation
must use check_token to include issuer-scoped rules. An error means the store
could not answer; the validator then refuses the token.Source§fn try_revoke_token(
&self,
issuer: &str,
jti: &str,
expires_at: u64,
) -> Result<RevokeOutcome, String>
fn try_revoke_token( &self, issuer: &str, jti: &str, expires_at: u64, ) -> Result<RevokeOutcome, String>
Revoke a holder-authenticated token only within its verified issuer.
This must use a separate key domain from operator-wide JTI rules.
Backends without scoped storage fail closed instead of widening the
holder’s authority to every issuer.
Source§fn check_token(
&self,
issuer: &str,
jti: &str,
uid: &str,
iat: u64,
) -> Result<Option<RevokedBy>, String>
fn check_token( &self, issuer: &str, jti: &str, uid: &str, iat: u64, ) -> Result<Option<RevokedBy>, String>
Check an issuer-scoped holder rule and the explicit operator-wide rules.
The default preserves global checks for older implementations, which
cannot accept scoped writes until they override both methods.
Source§fn revoke_instance(
&self,
instance_uid: &str,
cutoff: u64,
expires_at: u64,
) -> Result<(), String>
fn revoke_instance( &self, instance_uid: &str, cutoff: u64, expires_at: u64, ) -> Result<(), String>
Revoke tokens of an instance issued at or before
issued_at_or_before.
Repeated writes must never lower either the cutoff or retention time.Source§fn check(
&self,
jti: &str,
instance_uid: &str,
iat: u64,
) -> Result<Option<RevokedBy>, String>
fn check( &self, jti: &str, instance_uid: &str, iat: u64, ) -> Result<Option<RevokedBy>, String>
Check both the operator-wide token identifier and instance cutoff.
Source§fn health(&self) -> Option<RevocationHealth>
fn health(&self) -> Option<RevocationHealth>
Read local health without contacting storage.
None means the backend
does not expose a fallible dependency or availability guard.Auto Trait Implementations§
impl !Freeze for InMemoryRevocationStore
impl !RefUnwindSafe for InMemoryRevocationStore
impl Send for InMemoryRevocationStore
impl Sync for InMemoryRevocationStore
impl Unpin for InMemoryRevocationStore
impl UnsafeUnpin for InMemoryRevocationStore
impl UnwindSafe for InMemoryRevocationStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more