pub struct TokenBundle { /* private fields */ }Expand description
An OAuth token bundle crossing the credential port: the access token, the
refresh token (absent when the provider does not return one), the honest
expiry derived from the provider’s expires_in, and the granted scope.
This is the ONLY secret-bearing shape in the module. Material is private,
redacted in Debug, and zeroized on drop; accessors hand out &str
references for constructing provider requests (the token-exchange form,
the userinfo Authorization header) — never an owned copy.
Implementations§
Source§impl TokenBundle
impl TokenBundle
Sourcepub fn new(
access_token: String,
refresh_token: Option<String>,
expires_at: DateTime<Utc>,
scope: Option<String>,
) -> Self
pub fn new( access_token: String, refresh_token: Option<String>, expires_at: DateTime<Utc>, scope: Option<String>, ) -> Self
Assemble a bundle from a verified provider token response. Callers pass
expires_at = now + expires_in; a response without an expiry is
rejected upstream as unstoreable and never reaches this constructor.
Sourcepub fn access_token(&self) -> &str
pub fn access_token(&self) -> &str
The access token — for the Authorization header of a provider call.
Sourcepub fn refresh_token(&self) -> Option<&str>
pub fn refresh_token(&self) -> Option<&str>
The refresh token, when the provider issued one — for the
grant_type=refresh_token exchange form.
Sourcepub fn expires_at(&self) -> DateTime<Utc>
pub fn expires_at(&self) -> DateTime<Utc>
The honest expiry (mirrored on the account row; drives the refresh-before-expiry window).
Sourcepub fn metadata(&self) -> TokenMetadata
pub fn metadata(&self) -> TokenMetadata
Metadata safe for a response or log line — everything except the tokens. This is the shape HTTP surfaces may carry (the store’s metadata-only rule applied at the port).
Trait Implementations§
Source§impl Debug for TokenBundle
impl Debug for TokenBundle
Source§impl Drop for TokenBundle
impl Drop for TokenBundle
Auto Trait Implementations§
impl Freeze for TokenBundle
impl RefUnwindSafe for TokenBundle
impl Send for TokenBundle
impl Sync for TokenBundle
impl Unpin for TokenBundle
impl UnsafeUnpin for TokenBundle
impl UnwindSafe for TokenBundle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more