Skip to main content

TokenSource

Trait TokenSource 

Source
pub trait TokenSource: Send + Sync {
    // Required method
    fn token(&self) -> BoxFuture<'_, Result<String>>;

    // Provided method
    fn invalidate(&self) { ... }
}
Expand description

Returns a Chainguard bearer token whose audience includes DEFAULT_AUDIENCE (or, for the platform API, PLATFORM_AUDIENCE).

Implement it with a function through token_fn. Caching sources also implement invalidate: the client calls it when the plane answers Unauthenticated, so the next call fetches a fresh token.

Required Methods§

Source

fn token(&self) -> BoxFuture<'_, Result<String>>

Returns a token.

Provided Methods§

Source

fn invalidate(&self)

Forgets a cached token. The default does nothing.

Implementors§