Skip to main content

AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider: Send + Sync {
    // Required methods
    fn authenticate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 HttpRequest,
    ) -> Pin<Box<dyn Future<Output = Result<AuthResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate_api_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        api_key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ClientInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate_jwt<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<TokenClaims>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn scheme(&self) -> AuthScheme;
}
Expand description

Authentication provider trait

Required Methods§

Source

fn authenticate<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 HttpRequest, ) -> Pin<Box<dyn Future<Output = Result<AuthResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Authenticate a request

Source

fn validate_api_key<'life0, 'life1, 'async_trait>( &'life0 self, api_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ClientInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate API key

Source

fn validate_jwt<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<TokenClaims>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate JWT token

Source

fn scheme(&self) -> AuthScheme

Get authentication scheme

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§