pub struct MemoryTokenStore { /* private fields */ }Expand description
Tokens held in this process’s memory.
Wrong for production for the usual reason and one extra: a restart would empty the store, and an empty store answers “unknown token” to everything — which fails safe — but it also loses every revocation, and a revocation that a restart undoes is not a revocation.
Implementations§
Source§impl MemoryTokenStore
impl MemoryTokenStore
pub fn new() -> MemoryTokenStore
Sourcepub fn live_access(&self, now: u64) -> usize
pub fn live_access(&self, now: u64) -> usize
How many access tokens are usable right now. For tests.
Sourcepub fn live_refresh(&self, now: u64) -> usize
pub fn live_refresh(&self, now: u64) -> usize
How many refresh tokens are usable right now. For tests.
Trait Implementations§
Source§impl Default for MemoryTokenStore
impl Default for MemoryTokenStore
Source§impl TokenStore for MemoryTokenStore
impl TokenStore for MemoryTokenStore
fn store_access<'a>(&'a self, token: AccessToken) -> StoreFuture<'a, ()>
fn store_refresh<'a>(&'a self, token: RefreshToken) -> StoreFuture<'a, ()>
Source§fn find_access<'a>(
&'a self,
hash: &'a str,
) -> StoreFuture<'a, Option<AccessToken>>
fn find_access<'a>( &'a self, hash: &'a str, ) -> StoreFuture<'a, Option<AccessToken>>
Look a token up by its digest — the record whatever its state, so the
caller can tell “revoked” apart from “never existed” and act on it.
fn find_refresh<'a>( &'a self, hash: &'a str, ) -> StoreFuture<'a, Option<RefreshToken>>
Source§fn rotate<'a>(&'a self, id: &'a str) -> StoreFuture<'a, bool>
fn rotate<'a>(&'a self, id: &'a str) -> StoreFuture<'a, bool>
Mark a refresh token rotated, returning whether this call did it. Read more
fn revoke_access<'a>(&'a self, id: &'a str) -> StoreFuture<'a, ()>
fn revoke_refresh<'a>(&'a self, id: &'a str) -> StoreFuture<'a, ()>
Source§fn revoke_family<'a>(&'a self, family: &'a str) -> StoreFuture<'a, usize>
fn revoke_family<'a>(&'a self, family: &'a str) -> StoreFuture<'a, usize>
Revoke everything descended from one authorisation, returning how many
records changed. This is what a detected replay or reuse calls.
Auto Trait Implementations§
impl !Freeze for MemoryTokenStore
impl RefUnwindSafe for MemoryTokenStore
impl Send for MemoryTokenStore
impl Sync for MemoryTokenStore
impl Unpin for MemoryTokenStore
impl UnsafeUnpin for MemoryTokenStore
impl UnwindSafe for MemoryTokenStore
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