Skip to main content

TokenProvider

Trait TokenProvider 

Source
pub trait TokenProvider: Send + Sync {
    // Required methods
    fn authenticate<'life0, 'async_trait>(
        &'life0 self,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn refresh<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 Token,
    ) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn login<'life0, 'async_trait>(
        &'life0 self,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn can_authenticate_silently(&self) -> bool { ... }
}
Expand description

Provider-specific acquisition; persistence and locking belong to AuthClient.

Required Methods§

Source

fn authenticate<'life0, 'async_trait>( &'life0 self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Acquire a new credential within the supplied login timeout.

Source

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

Renew a credential without silently starting an interactive login.

Provided Methods§

Source

fn login<'life0, 'async_trait>( &'life0 self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<Token>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Perform an explicitly requested login; defaults to normal acquisition.

Source

fn can_authenticate_silently(&self) -> bool

Whether acquisition is safe without an explicit interactive login request.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§