[][src]Struct oxide_auth::primitives::issuer::TokenMap

pub struct TokenMap<G: TagGrant = Box<dyn TagGrant + Send + Sync + 'static>> { /* fields omitted */ }

Keeps track of access and refresh tokens by a hash-map.

The generator is itself trait based and can be chosen during construction. It is assumed to not be possible (or at least very unlikely during their overlapping lifetime) for two different grants to generate the same token in the grant tagger.

Methods

impl<G: TagGrant> TokenMap<G>
[src]

pub fn new(generator: G) -> Self
[src]

Construct a TokenMap from the given generator.

pub fn valid_for(&mut self, duration: Duration)
[src]

Set the validity of all issued grants to the specified duration.

pub fn valid_for_default(&mut self)
[src]

All grants are valid for their default duration.

pub fn revoke(&mut self, token: &str)
[src]

Unconditionally delete grant associated with the token.

This is the main advantage over signing tokens. By keeping internal state of allowed grants, the resource owner or other instances can revoke a token before it expires naturally. There is no differentiation between access and refresh tokens since these should have a marginal probability of colliding.

pub fn import_grant(&mut self, token: String, grant: Grant)
[src]

Directly associate token with grant.

No checks on the validity of the grant are performed but the expiration time of the grant is modified (if a duration was previously set).

Trait Implementations

impl<G: TagGrant> Issuer for TokenMap<G>
[src]

Auto Trait Implementations

impl<G> Send for TokenMap<G> where
    G: Send

impl<G> Sync for TokenMap<G> where
    G: Sync

Blanket Implementations

impl<T> OptIssuer for T where
    T: Issuer
[src]

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> UnsafeAny for T where
    T: Any

impl<T> IntoCollection for T

impl<T, I> AsResult for T where
    I: Input,