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§
Sourcefn 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 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.
Provided Methods§
Sourcefn supports_refresh(&self) -> bool
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".