Trait yup_oauth2::TokenStorage
[−]
[src]
pub trait TokenStorage {
type Error: 'static + Error;
fn set(&mut self,
scope_hash: u64,
scopes: &Vec<&str>,
token: Option<Token>)
-> Result<(), Self::Error>;
fn get(&self,
scope_hash: u64,
scopes: &Vec<&str>)
-> Result<Option<Token>, Self::Error>;
}Implements a specialized storage to set and retrieve Token instances.
The scope_hash represents the signature of the scopes for which the given token
should be stored or retrieved.
For completeness, the underlying, sorted scopes are provided as well. They might be
useful for presentation to the user.
Associated Types
Required Methods
fn set(&mut self,
scope_hash: u64,
scopes: &Vec<&str>,
token: Option<Token>)
-> Result<(), Self::Error>
scope_hash: u64,
scopes: &Vec<&str>,
token: Option<Token>)
-> Result<(), Self::Error>
If token is None, it is invalid or revoked and should be removed from storage.
Otherwise, it should be saved.
fn get(&self,
scope_hash: u64,
scopes: &Vec<&str>)
-> Result<Option<Token>, Self::Error>
scope_hash: u64,
scopes: &Vec<&str>)
-> Result<Option<Token>, Self::Error>
A None result indicates that there is no token for the given scope_hash.
Implementors
impl TokenStorage for NullStorageimpl TokenStorage for MemoryStorageimpl TokenStorage for DiskTokenStorage