Trait AuthProvider
pub trait AuthProvider: Send + Sync {
// Required methods
fn authenticate<'life0, 'life1, 'async_trait>(
&'life0 self,
credentials: &'life1 Credentials,
) -> Pin<Box<dyn Future<Output = Result<AuthContext, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn validate<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn provider_name(&self) -> &str;
}Expand description
Trait for pluggable authentication providers.
Required Methods§
fn authenticate<'life0, 'life1, 'async_trait>(
&'life0 self,
credentials: &'life1 Credentials,
) -> Pin<Box<dyn Future<Output = Result<AuthContext, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn authenticate<'life0, 'life1, 'async_trait>(
&'life0 self,
credentials: &'life1 Credentials,
) -> Pin<Box<dyn Future<Output = Result<AuthContext, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Authenticate credentials and return an auth context.
fn validate<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn validate<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Validate an existing auth context (e.g., check if still valid).
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn revoke<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Revoke authentication (e.g., invalidate a token).
fn provider_name(&self) -> &str
fn provider_name(&self) -> &str
Get the provider name.