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