pub struct OAuthToken {
pub token: String,
pub token_type: TokenType,
pub client_id: String,
pub scopes: Vec<String>,
pub issued_at: Instant,
pub expires_at: Instant,
pub subject: Option<String>,
pub is_refresh_token: bool,
}Expand description
OAuth token (access or refresh).
Fields§
§token: StringToken value.
token_type: TokenTypeToken type.
client_id: StringClient ID this token was issued to.
scopes: Vec<String>Approved scopes.
issued_at: InstantWhen the token was issued.
expires_at: InstantWhen the token expires.
subject: Option<String>Subject (user) this token was issued for.
is_refresh_token: boolWhether this is a refresh token.
Implementations§
Source§impl OAuthToken
impl OAuthToken
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Checks if this token has expired.
Sourcepub fn expires_in_secs(&self) -> u64
pub fn expires_in_secs(&self) -> u64
Returns the remaining lifetime in seconds.
Trait Implementations§
Source§impl Clone for OAuthToken
impl Clone for OAuthToken
Source§fn clone(&self) -> OAuthToken
fn clone(&self) -> OAuthToken
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OAuthToken
impl RefUnwindSafe for OAuthToken
impl Send for OAuthToken
impl Sync for OAuthToken
impl Unpin for OAuthToken
impl UnwindSafe for OAuthToken
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).