Struct aliri_tokens::TokenWithLifetime

source ·
pub struct TokenWithLifetime { /* private fields */ }
Expand description

A token as returned by the authority with some additional lifetime information

Implementations§

source§

impl TokenWithLifetime

source

pub fn access_token(&self) -> &AccessTokenRef

Gets the current access token

source

pub fn id_token(&self) -> Option<&IdTokenRef>

Gets the current ID token, if available

source

pub fn lifetime(&self) -> DurationSecs

Gets the token’s lifetime

source

pub fn issued(&self) -> UnixTime

Gets the time that the token was issued

source

pub fn stale(&self) -> UnixTime

Gets the time that the token will become stale

source

pub fn expiry(&self) -> UnixTime

Gets the time that the token will expire

source

pub fn fresh_interval(&self) -> Range<UnixTime>

Gets the interval during which the token should be considered fresh

source

pub fn valid_interval(&self) -> Range<UnixTime>

Gets the interval during which the token is valid

source

pub fn token_status(&self) -> TokenStatus

Gets the token’s current lifetime status

source

pub fn token_status_with_clock<C: Clock>(&self, clock: &C) -> TokenStatus

Gets the token’s lifetime status based on the current time as reported by the provided clock

source

pub fn token_status_at(&self, time: UnixTime) -> TokenStatus

Gets the token’s lifetime status as of the provided time

source

pub fn until_stale(&self) -> DurationSecs

Gets a duration for how much longer the token will be fresh

source

pub fn until_stale_with_clock<C: Clock>(&self, clock: &C) -> DurationSecs

Gets a duration for how much longer the token will be fresh based on the current time as reported by the provided clock

source

pub fn until_stale_at(&self, time: UnixTime) -> DurationSecs

Gets a duration for how much longer the token would be fresh as of the provided time

source

pub fn until_expired(&self) -> DurationSecs

Gets a duration for how much longer the token will be valid

source

pub fn until_expired_with_clock<C: Clock>(&self, clock: &C) -> DurationSecs

Gets a duration for how much longer the token will be valid based on the current time as reported by the provided clock

source

pub fn until_expired_at(&self, time: UnixTime) -> DurationSecs

Gets a duration for how much longer the token would be valid as of the provided time

Trait Implementations§

source§

impl Debug for TokenWithLifetime

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for TokenWithLifetime

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for TokenWithLifetime

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,