pub struct RevokedTokens { /* private fields */ }Expand description
Best-effort, in-memory logout denylist for session tokens.
Deliberately NOT durable: a stateless token’s only revocation cost is the window between logout and its natural expiry, bounded by the caller’s own TTL policy; losing this set on restart means a logged-out token near the end of its TTL might verify again after a restart, which callers of this module accept as the tradeoff for a session that needs no durable store.
Implementations§
Source§impl RevokedTokens
impl RevokedTokens
Sourcepub fn reap(&self, now_ms: u64)
pub fn reap(&self, now_ms: u64)
Evict every denylisted token that could never verify again anyway: a
token past its OWN embedded expires_ms already fails
verify_session’s expiry check regardless of denylist membership,
so keeping it here forever only grows the set. A token that fails to
even PARSE (decode_session_payload returns None — never
produced by mint_session, but Self::revoke accepts whatever
string a caller posts) can likewise never match a real session and is
dropped too. Bounds this set’s memory to sessions logged out within
their own TTL window, not the lifetime of the process.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RevokedTokens
impl RefUnwindSafe for RevokedTokens
impl Send for RevokedTokens
impl Sync for RevokedTokens
impl Unpin for RevokedTokens
impl UnsafeUnpin for RevokedTokens
impl UnwindSafe for RevokedTokens
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more