pub struct InMemoryTokenStore { /* private fields */ }Available on crate feature
server only.Expand description
A TokenStore held in memory, for tests, small deployments and getting started.
Lookup is a linear scan with a constant-time comparison per entry, which is the right trade-off up to a few thousand peers; beyond that, index by a keyed hash of the token in your own store rather than by the token itself.
Implementations§
Source§impl InMemoryTokenStore
impl InMemoryTokenStore
Sourcepub fn insert(&self, token: CredentialsToken, peer: AuthenticatedPeer)
pub fn insert(&self, token: CredentialsToken, peer: AuthenticatedPeer)
Registers a token.
Sourcepub fn remove(&self, token: &CredentialsToken)
pub fn remove(&self, token: &CredentialsToken)
Removes a token, as a credentials DELETE does.
Sourcepub fn rotate(&self, peer_id: &str, new_token: CredentialsToken) -> bool
pub fn rotate(&self, peer_id: &str, new_token: CredentialsToken) -> bool
Replaces one platform’s token, as a credentials PUT does.
It is advisable to renew the credentials tokens at least once a month.
Trait Implementations§
Source§impl Debug for InMemoryTokenStore
impl Debug for InMemoryTokenStore
Source§impl Default for InMemoryTokenStore
impl Default for InMemoryTokenStore
Source§fn default() -> InMemoryTokenStore
fn default() -> InMemoryTokenStore
Returns the “default value” for a type. Read more
Source§impl TokenStore for InMemoryTokenStore
impl TokenStore for InMemoryTokenStore
Source§fn resolve(&self, token: &CredentialsToken) -> Option<AuthenticatedPeer>
fn resolve(&self, token: &CredentialsToken) -> Option<AuthenticatedPeer>
Looks up the platform a token belongs to. Read more
Auto Trait Implementations§
impl !Freeze for InMemoryTokenStore
impl RefUnwindSafe for InMemoryTokenStore
impl Send for InMemoryTokenStore
impl Sync for InMemoryTokenStore
impl Unpin for InMemoryTokenStore
impl UnsafeUnpin for InMemoryTokenStore
impl UnwindSafe for InMemoryTokenStore
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