Skip to main content

AuthStrategy

Trait AuthStrategy 

Source
pub trait AuthStrategy: Send + Sync {
    // Required method
    fn authenticate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 mut Request<Bytes>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

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

Puts credentials on a request. The default, BearerAuth, sets an Authorization header from a TokenProvider; anything else can plug in here.

Required Methods§

Source

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

Puts the credentials on a request about to be sent.

Provided Methods§

Source

fn refresh<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asked once when a request is answered with 401; see TokenProvider::refresh.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§