pub enum AuthTokenState {
Valid {
expires_in: Duration,
},
NearExpiry {
expires_in: Duration,
},
Expired {
expired_for: Duration,
},
Invalid,
}Expand description
Describes the observed state of the current auth token.
This type is intentionally framework agnostic. HTTP adapters and other delivery layers can translate transport-specific validation results into this domain-level model before invoking session renewal logic.
Variants§
Valid
The auth token is currently valid and does not need renewal.
NearExpiry
The auth token is still valid but has entered the proactive renewal window.
Expired
The auth token has expired.
Invalid
The auth token is malformed, revoked, or otherwise invalid.
Implementations§
Source§impl AuthTokenState
impl AuthTokenState
Sourcepub fn is_currently_usable(self) -> bool
pub fn is_currently_usable(self) -> bool
Returns true when the current token may still authorize the request.
Sourcepub fn should_attempt_proactive_renewal(self) -> bool
pub fn should_attempt_proactive_renewal(self) -> bool
Returns true when the token has entered the proactive renewal window.
Sourcepub fn requires_renewal(self) -> bool
pub fn requires_renewal(self) -> bool
Returns true when successful renewal is required before a caller may
continue.
Sourcepub fn is_invalid(self) -> bool
pub fn is_invalid(self) -> bool
Returns true when the token must be rejected without renewal.
Trait Implementations§
Source§impl Clone for AuthTokenState
impl Clone for AuthTokenState
Source§fn clone(&self) -> AuthTokenState
fn clone(&self) -> AuthTokenState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuthTokenState
impl Debug for AuthTokenState
Source§impl Hash for AuthTokenState
impl Hash for AuthTokenState
Source§impl PartialEq for AuthTokenState
impl PartialEq for AuthTokenState
Source§fn eq(&self, other: &AuthTokenState) -> bool
fn eq(&self, other: &AuthTokenState) -> bool
self and other values to be equal, and is used by ==.