Skip to main content

CookieTokenStore

Struct CookieTokenStore 

Source
pub struct CookieTokenStore { /* private fields */ }
Available on crate feature cookie only.
Expand description

A TokenStore carrying the token in a hardened cookie: __Host- prefixed, Secure, HttpOnly, SameSite=Lax, and scoped to /.

Requires the cookie layer (RouterBuilder::cookies) to be registered on the router.

Implementations§

Source§

impl CookieTokenStore

Source

pub fn new() -> Self

Creates a store using SESSION_COOKIE_NAME.

Source

pub fn name(self, name: impl Into<Cow<'static, str>>) -> Self

Overrides the name of the session cookie.

Trait Implementations§

Source§

impl Default for CookieTokenStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl TokenStore for CookieTokenStore

Source§

fn read<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, Option<Token>>

Reads the token presented by the current request, or None when the request carries none (or a malformed one).
Source§

fn write<'a>( &'a self, cx: &'a Cx, token: Token, max_age: Duration, ) -> TokenStoreFuture<'a, ()>

Issues token to the client with the given time to live, replacing any previously issued token.
Source§

fn delete<'a>(&'a self, cx: &'a Cx) -> TokenStoreFuture<'a, ()>

Instructs the client to discard its token.

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