TokenStrategy

Trait TokenStrategy 

Source
pub trait TokenStrategy:
    Send
    + Sync
    + Debug {
    // Required methods
    fn get_token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn clear_token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn should_persist(&self) -> bool;
    fn strategy_type(&self) -> &'static str;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Token management strategy trait for different token handling approaches

Required Methods§

Source

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

Gets a valid authentication token

Source

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

Clears stored token (for testing)

Source

fn should_persist(&self) -> bool

Returns whether this strategy should persist tokens

Source

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

Returns the strategy type for debugging

Source

fn as_any(&self) -> &dyn Any

Returns self as Any for downcasting (used internally)

Implementors§