pub struct TokenRecord {
pub family: TokenFamily,
pub scope: ScopeSet,
pub access_token: TokenSecret,
pub refresh_token: Option<TokenSecret>,
pub issued_at: OffsetDateTime,
pub expires_at: OffsetDateTime,
pub revoked_at: Option<OffsetDateTime>,
}Expand description
Immutable record describing issued OAuth tokens.
Fields§
§family: TokenFamilyLogical token grouping (tenant/principal/provider).
scope: ScopeSetNormalized scopes granted to this record.
access_token: TokenSecretAccess token secret; callers must avoid logging it.
refresh_token: Option<TokenSecret>Refresh token secret, if the provider issued one.
issued_at: OffsetDateTimeIssued-at instant recorded from the provider response.
expires_at: OffsetDateTimeExpiry instant derived from issued_at plus expires_in or absolute expiry.
revoked_at: Option<OffsetDateTime>Revocation instant if the record has been revoked.
Implementations§
Source§impl TokenRecord
impl TokenRecord
Sourcepub fn builder(family: TokenFamily, scope: ScopeSet) -> TokenRecordBuilder
pub fn builder(family: TokenFamily, scope: ScopeSet) -> TokenRecordBuilder
Returns a builder for constructing rotation-friendly records.
Sourcepub fn status_at(&self, instant: OffsetDateTime) -> TokenStatus
pub fn status_at(&self, instant: OffsetDateTime) -> TokenStatus
Computes the lifecycle status at a given instant.
Sourcepub fn status(&self) -> TokenStatus
pub fn status(&self) -> TokenStatus
Convenience helper that checks the status using the current UTC instant.
Sourcepub fn is_pending_at(&self, instant: OffsetDateTime) -> bool
pub fn is_pending_at(&self, instant: OffsetDateTime) -> bool
Returns true if the record is considered pending at the provided instant.
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Returns true if the record is currently pending (issued_at in the future).
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns true if the record is currently active (not pending/expired/revoked).
Sourcepub fn is_expired_at(&self, instant: OffsetDateTime) -> bool
pub fn is_expired_at(&self, instant: OffsetDateTime) -> bool
Returns true if the record has expired at the provided instant.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true if the record is expired relative to the current clock.
Sourcepub fn is_revoked(&self) -> bool
pub fn is_revoked(&self) -> bool
Returns true if the record has been revoked.
Sourcepub fn revoke(&mut self, instant: OffsetDateTime)
pub fn revoke(&mut self, instant: OffsetDateTime)
Marks the record as revoked.
Trait Implementations§
Source§impl Clone for TokenRecord
impl Clone for TokenRecord
Source§fn clone(&self) -> TokenRecord
fn clone(&self) -> TokenRecord
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more