Struct AuthMap

Source
pub struct AuthMap<I: TagGrant = Box<dyn TagGrant + Send + Sync + 'static>> { /* private fields */ }
Expand description

An in-memory hash map.

This authorizer saves a mapping of generated strings to their associated grants. The generator is itself trait based and can be chosen during construction. It is assumed to not be possible for two different grants to generate the same token in the issuer.

Implementations§

Source§

impl<I: TagGrant> AuthMap<I>

Source

pub fn new(tagger: I) -> Self

Create an authorizer generating tokens with the tagger.

The token map is initially empty and is filled by methods provided in its Authorizer implementation.

Trait Implementations§

Source§

impl<I: TagGrant> Authorizer for AuthMap<I>

Source§

fn authorize(&mut self, grant: Grant) -> Result<String, ()>

Create a code which allows retrieval of a bearer token at a later time.
Source§

fn extract<'a>(&mut self, grant: &'a str) -> Result<Option<Grant>, ()>

Retrieve the parameters associated with a token, invalidating the code in the process. In particular, a code should not be usable twice (there is no stateless implementation of an authorizer for this reason).

Auto Trait Implementations§

§

impl<I> Freeze for AuthMap<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for AuthMap<I>
where I: RefUnwindSafe,

§

impl<I> Send for AuthMap<I>
where I: Send,

§

impl<I> Sync for AuthMap<I>
where I: Sync,

§

impl<I> Unpin for AuthMap<I>
where I: Unpin,

§

impl<I> UnwindSafe for AuthMap<I>
where I: UnwindSafe,

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, 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> OptAuthorizer for T
where T: Authorizer,

Source§

fn opt_mut(&mut self) -> Option<&mut dyn Authorizer>

Reference this mutably as an Authorizer or Option::None.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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> ErasedDestructor for T
where T: 'static,