Trait AuthMethod

Source
pub trait AuthMethod: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn authenticate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        credential: &'life1 Credential,
        metadata: &'life2 CredentialMetadata,
    ) -> Pin<Box<dyn Future<Output = Result<MethodResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn validate_config(&self) -> Result<()>;

    // Provided methods
    fn supports_refresh(&self) -> bool { ... }
    fn refresh_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _refresh_token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<AuthToken>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Trait for authentication methods.

Required Methods§

Source

fn name(&self) -> &str

Get the name of this authentication method.

Source

fn authenticate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, credential: &'life1 Credential, metadata: &'life2 CredentialMetadata, ) -> Pin<Box<dyn Future<Output = Result<MethodResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Authenticate using the provided credentials.

Source

fn validate_config(&self) -> Result<()>

Validate configuration for this method.

Provided Methods§

Source

fn supports_refresh(&self) -> bool

Check if this method supports refresh tokens.

Source

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

Refresh a token if supported.

Implementors§