pub struct TokenSet {
pub access_token: String,
pub token_type: String,
pub refresh_token: Option<String>,
pub scope: Option<String>,
pub id_token: Option<String>,
pub expires_at: Option<SystemTime>,
}Expand description
Tokens held by the application
Produced from a TokenResponse via From, which resolves the
relative expires_in into an absolute expires_at.
Serializable so a TokenStore implementation can
persist it.
Fields§
§access_token: StringThe access token
token_type: StringThe token type, almost always Bearer (case-insensitive)
refresh_token: Option<String>Refresh token, when the server issued one
scope: Option<String>The granted scope, when the server reported it
id_token: Option<String>OpenID Connect ID token; passed through as-is, not validated
expires_at: Option<SystemTime>Absolute access token expiration; None when the server did not
report a lifetime (or reported one too large to represent)
Implementations§
Source§impl TokenSet
impl TokenSet
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true when the access token has expired
A token without a known lifetime never reports as expired.
Sourcepub fn expires_within(&self, leeway: Duration) -> bool
pub fn expires_within(&self, leeway: Duration) -> bool
Returns true when the access token expires within leeway from
now (or already has)
A leeway too large to represent covers any expiration.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TokenSet
impl<'de> Deserialize<'de> for TokenSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TokenSet
Source§impl From<TokenResponse> for TokenSet
impl From<TokenResponse> for TokenSet
Source§fn from(response: TokenResponse) -> Self
fn from(response: TokenResponse) -> Self
impl StructuralPartialEq for TokenSet
Auto Trait Implementations§
impl Freeze for TokenSet
impl RefUnwindSafe for TokenSet
impl Send for TokenSet
impl Sync for TokenSet
impl Unpin for TokenSet
impl UnsafeUnpin for TokenSet
impl UnwindSafe for TokenSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.