Skip to main content

TokenSource

Trait TokenSource 

Source
pub trait TokenSource:
    Send
    + Sync
    + Debug {
    // Required method
    fn fetch_bearer(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + '_>>;
}
Expand description

A source of bearer tokens for request authentication.

Implemented by canton_auth::TokenProvider (OIDC client-credentials with caching + refresh). Object-safe by design: Auth::Dynamic stores it as an Arc<dyn TokenSource>.

Required Methods§

Source

fn fetch_bearer( &self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + '_>>

Resolve the current bearer token (fetching/refreshing as needed), or None for an unauthenticated call.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§