AuthProvider

Trait AuthProvider 

Source
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§

Source

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.

Source

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).

Source

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).

Source

fn provider_name(&self) -> &str

Get the provider name.

Implementors§