pub struct StoreAuth<S: UserStore> { /* private fields */ }Expand description
Implementations§
Source§impl<S: UserStore> StoreAuth<S>
impl<S: UserStore> StoreAuth<S>
Sourcepub fn new(store: S, config: &StoreAuthConfig) -> Self
pub fn new(store: S, config: &StoreAuthConfig) -> Self
Create a new StoreAuth wrapping the given store.
For backends that need batched traffic recording, use
with_traffic_recorder after construction.
Sourcepub fn cache_enabled(&self) -> bool
pub fn cache_enabled(&self) -> bool
Check if caching is enabled.
Sourcepub fn cache_stats(&self) -> Option<CacheStats>
pub fn cache_stats(&self) -> Option<CacheStats>
Get cache statistics. Returns None if caching is disabled.
Sourcepub fn cache_invalidate(&self, hash: &str)
pub fn cache_invalidate(&self, hash: &str)
Invalidate cache entry by password hash.
Also removes the hash from the negative cache so that a newly-added user is not blocked by a stale negative entry.
Sourcepub fn cache_invalidate_user(&self, user_id: &str)
pub fn cache_invalidate_user(&self, user_id: &str)
Invalidate all cache entries for a user.
Sourcepub fn cache_clear(&self)
pub fn cache_clear(&self)
Clear all cache entries.
Trait Implementations§
Source§impl<S: UserStore + 'static> AuthBackend for StoreAuth<S>
impl<S: UserStore + 'static> AuthBackend for StoreAuth<S>
Source§fn verify<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<AuthResult, AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn verify<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<AuthResult, AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Verify a password hash. Read more
Source§fn record_traffic<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
bytes: u64,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_traffic<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
bytes: u64,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Optional: Record traffic usage for a user. Read more
Auto Trait Implementations§
impl<S> Freeze for StoreAuth<S>
impl<S> !RefUnwindSafe for StoreAuth<S>
impl<S> Send for StoreAuth<S>
impl<S> Sync for StoreAuth<S>
impl<S> Unpin for StoreAuth<S>
impl<S> UnsafeUnpin for StoreAuth<S>
impl<S> !UnwindSafe for StoreAuth<S>
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