pub struct OAuthToken {
pub token: String,
pub token_type: TokenType,
pub client_id: String,
pub scopes: Vec<String>,
pub resource: Option<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).
This value contains token metadata only. Raw bearer credentials are never retained in server state and therefore cannot be recovered through token introspection.
Fields§
§token: StringAuxiliary token text supplied by callers constructing standalone token metadata.
Server-issued and introspected values always leave this empty; raw
bearer credentials are retained only by the one-shot TokenResponse.
token_type: TokenTypeToken type.
client_id: StringClient ID this token was issued to.
scopes: Vec<String>Approved scopes.
resource: Option<String>Exact RFC 8707 resource/audience binding, if the grant specified one.
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 (const: unstable) · 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 UnsafeUnpin for OAuthToken
impl UnwindSafe for OAuthToken
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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).