pub trait AuthBackend: Send + Sync {
// Required method
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;
// Provided method
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 { ... }
}Expand description
Trait for authentication backends.
Implementations must be thread-safe (Send + Sync) as they may be
called concurrently from multiple connections.
Required Methods§
Provided Methods§
Sourcefn 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.
Default implementation does nothing.
Implementations on Foreign Types§
Source§impl<A: AuthBackend + ?Sized> AuthBackend for Box<A>
Blanket implementation for Box<A> where A: AuthBackend.
impl<A: AuthBackend + ?Sized> AuthBackend for Box<A>
Blanket implementation for Box<A> where A: AuthBackend.
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 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,
Source§impl<A: AuthBackend + ?Sized> AuthBackend for Arc<A>
Blanket implementation for Arc<A> where A: AuthBackend.
impl<A: AuthBackend + ?Sized> AuthBackend for Arc<A>
Blanket implementation for Arc<A> where A: AuthBackend.
This allows passing Arc<AuthBackend> directly to functions expecting impl AuthBackend.