Skip to main content

TokenSource

Trait TokenSource 

Source
pub trait TokenSource: Send + Sync {
    // Required methods
    fn load<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn name(&self) -> &'static str;

    // Provided method
    fn supports_refresh(&self) -> bool { ... }
}
Expand description

A source of bearer tokens, returned as (actor_id, token) pairs in plaintext. The caller is expected to hash tokens before storing them.

Required Methods§

Source

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

Fetch the current set of actor → token pairs.

Called once at startup. Implementations that support rotation may also be polled periodically.

Source

fn name(&self) -> &'static str

Human-readable name for logs and error messages.

Provided Methods§

Source

fn supports_refresh(&self) -> bool

Whether this source can be re-fetched for rotation without restart. Default: false (one-shot sources).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§