pub trait TokenCache: Sync {
    // Required methods
    fn token_and_exp<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Option<(String, u64)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_token<'life0, 'async_trait>(
        &'life0 self,
        token: String,
        exp: u64
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn scope<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn fetch_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        client: &'life1 Client
    ) -> Pin<Box<dyn Future<Output = Result<(String, u64)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

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

Trait that refreshes a token when it is expired

Required Methods§

source

fn token_and_exp<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Option<(String, u64)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the token that is currently held within the instance of TokenCache, together with the expiry of that token as a u64 in seconds sine the Unix Epoch (1 Jan 1970).

source

fn set_token<'life0, 'async_trait>( &'life0 self, token: String, exp: u64 ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Updates the token to the value token.

source

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

Returns the intended scope for the current token.

source

fn fetch_token<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 Client ) -> Pin<Box<dyn Future<Output = Result<(String, u64)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches and returns the token using the service account

Provided Methods§

source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 Client ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a valid, unexpired token. If the contained token is expired, it updates and returns the token.

Implementors§