Skip to main content

AccessTokenSource

Trait AccessTokenSource 

Source
pub trait AccessTokenSource:
    Send
    + Sync
    + 'static {
    // Required method
    fn token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Supplies the OAuth2 bearer token for the cloud-CDN backends that authenticate against a Google / Azure management API.

Both APIs take a short-lived (~1h) access token. Production deployments should implement this against their environment’s token endpoint — the GCE/GKE metadata server, a workload-identity exchange, or a refreshing gcloud auth / az account helper — so the token is renewed before it expires. None means “no token available right now”; the purge is then skipped (best-effort, per the PageCacheInvalidator contract).

Required Methods§

Source

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

Return a fresh bearer token, or None to skip the purge.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§