Trait yup_oauth2::storage::TokenStorage
source · pub trait TokenStorage: Send + Sync {
// Required methods
fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
token: TokenInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Option<TokenInfo>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
Implement your own token storage solution by implementing this trait. You need a way to store and retrieve tokens, each keyed by a set of scopes.
Required Methods§
sourcefn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
token: TokenInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
token: TokenInfo,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a token for the given set of scopes so that it can be retrieved later by get() TokenInfo can be serialized with serde.
sourcefn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Option<TokenInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
scopes: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Option<TokenInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve a token stored by set for the given set of scopes