Skip to main content

InMemoryRevocationStore

Struct InMemoryRevocationStore 

Source
pub struct InMemoryRevocationStore { /* private fields */ }
Expand description

In-memory revocation store with lazy expiry sweeps. Suitable for single-instance deployments and testing.

Implementations§

Source§

impl InMemoryRevocationStore

Source

pub fn new() -> Self

Create an empty store.

Source

pub fn sweep(&self, now_s: u64)

Remove entries whose expires_at is in the past.

Source

pub fn len(&self) -> usize

Number of entries currently stored (for metrics/testing).

Source

pub fn is_empty(&self) -> bool

True when the store is empty.

Trait Implementations§

Source§

impl Default for InMemoryRevocationStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl RevocationStore for InMemoryRevocationStore

Source§

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>

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>

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>

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>

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>

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>

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>

Check both the operator-wide token identifier and instance cutoff.
Source§

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,