pub trait TokenBackend: Send + Sync {
// Required methods
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<TokenSet>, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn save<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
email: &'life1 str,
tokens: &'life2 TokenSet,
) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided method
fn on_access_token(&self, _email: &str, _access_token: &str) { ... }
}Expand description
Where an account’s TokenSet is loaded from and saved to.
Implementations must be safe to share across tasks; AuthClient holds one
behind an Arc.
Required Methods§
Sourcefn load<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<TokenSet>, ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<TokenSet>, ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load the stored tokens for email. Ok(None) means “no session”.
Sourcefn save<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
email: &'life1 str,
tokens: &'life2 TokenSet,
) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
email: &'life1 str,
tokens: &'life2 TokenSet,
) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Persist tokens for email, replacing whatever was stored before.
Provided Methods§
Sourcefn on_access_token(&self, _email: &str, _access_token: &str)
fn on_access_token(&self, _email: &str, _access_token: &str)
Hook invoked with every access token handed out by
super::AuthClient::get_valid_token. The default is a no-op; the
CLI backend uses it to backfill account metadata.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".