Skip to main content

AuthStrategy

Trait AuthStrategy 

Source
pub trait AuthStrategy: Send + Sync {
    // Required methods
    fn authenticate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 AuthConfig,
    ) -> Pin<Box<dyn Future<Output = Result<Credentials>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate_credentials(&self, credentials: &Credentials) -> bool;

    // Provided method
    fn refresh_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _credentials: &'life1 Credentials,
    ) -> Pin<Box<dyn Future<Output = Result<Credentials>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

One implementation per auth scheme discovered in the OpenAPI spec (REQ-1.2.2). refresh_token’s default errors out, since not every scheme has a refresh flow (only OAuth2 does in practice) — overridden by the strategies that do.

Required Methods§

Source

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

Source

fn validate_credentials(&self, credentials: &Credentials) -> bool

Provided Methods§

Source

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

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§