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§
Sourcefn 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 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
Sourcefn 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 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)
Sourcefn should_persist(&self) -> bool
fn should_persist(&self) -> bool
Returns whether this strategy should persist tokens
Sourcefn strategy_type(&self) -> &'static str
fn strategy_type(&self) -> &'static str
Returns the strategy type for debugging