Trait gcp_auth::TokenProvider

source ·
pub trait TokenProvider: Send + Sync {
    // Required methods
    fn token<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        scopes: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<Arc<Token>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn project_id<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<str>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A trait for an authentication context that can provide tokens

Required Methods§

source

fn token<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, scopes: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Arc<Token>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get a valid token for the given scopes

Tokens are cached until they expire, so this method will only fetch a fresh token once the current token (for the given scopes) has expired.

source

fn project_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Arc<str>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the project ID for the authentication context

Implementors§