pub struct InMemorySessionStore { /* private fields */ }Expand description
Process-local ISessionStore — the dependency-free default.
Suitable for a single-process deployment, tests and development. Two limitations are deliberate and documented rather than hidden:
- Revocations die with the process (a restart resurrects every token that has not expired yet) — use a persistent store in production when that matters.
- Revoked
jtis are never garbage-collected (the store cannot know when a token expires), so a long-running process accumulates oneStringper revoked token. ISessionStore::revoke_all_for_subjectis not supported: the store keeps no subject index.
Implementations§
Source§impl InMemorySessionStore
impl InMemorySessionStore
Sourcepub fn revoked_count(&self) -> usize
pub fn revoked_count(&self) -> usize
Number of revoked token ids currently tracked (diagnostics/tests).
Trait Implementations§
Source§impl Debug for InMemorySessionStore
impl Debug for InMemorySessionStore
Source§impl Default for InMemorySessionStore
impl Default for InMemorySessionStore
Source§impl ISessionStore for InMemorySessionStore
impl ISessionStore for InMemorySessionStore
Source§fn revoke<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Revoke one token by its
jti (logout of a single session). Read moreSource§fn is_revoked<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_revoked<'life0, 'life1, 'async_trait>(
&'life0 self,
jti: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether the token
jti has been revoked.Source§fn revoke_all_for_subject<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn revoke_all_for_subject<'life0, 'life1, 'async_trait>(
&'life0 self,
subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Revoke every token of
subject (“sign out everywhere”). Read moreAuto Trait Implementations§
impl !Freeze for InMemorySessionStore
impl Forget for InMemorySessionStore
impl Move for InMemorySessionStore
impl RefUnwindSafe for InMemorySessionStore
impl Send for InMemorySessionStore
impl Sync for InMemorySessionStore
impl Unpin for InMemorySessionStore
impl UnsafeUnpin for InMemorySessionStore
impl UnwindSafe for InMemorySessionStore
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