Skip to main content

TokenFetcher

Trait TokenFetcher 

Source
pub trait TokenFetcher {
    // Required method
    async fn fetch_token(&self, provider: &str) -> Result<BrokerToken, String>;

    // Provided method
    async fn fetch_credential(
        &self,
        cred: &CredentialRef,
    ) -> Result<BrokerToken, TokenFetchError> { ... }
}
Expand description

“Get a fresh access token from somewhere.” Abstracted so the cache/resolve logic is unit-testable without real HTTP. The real impl is BrokerClient.

Required Methods§

Source

async fn fetch_token(&self, provider: &str) -> Result<BrokerToken, String>

Provided Methods§

Source

async fn fetch_credential( &self, cred: &CredentialRef, ) -> Result<BrokerToken, TokenFetchError>

Account-addressed fetch. Default: the default slot goes through fetch_token; a named slot is unsupported (never silently served from the default slot).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§