Skip to main content

SessionConfigBuilder

Struct SessionConfigBuilder 

Source
pub struct SessionConfigBuilder { /* private fields */ }
Expand description

Assembles a SessionConfig. Created with SessionConfig::builder.

Implementations§

Source§

impl SessionConfigBuilder

Source

pub fn token_store(self, token_store: impl TokenStore + 'static) -> Self

Overrides the TokenStore carrying the session token between the client and the server.

Source

pub fn lifetime(self, lifetime: Duration) -> Self

Overrides how long a session lives without being refreshed.

The lifetime becomes the time to live of every issued token, and start, refresh, and rotate derive the session’s expires_at from it.

Source

pub fn trust_origin(self, origin: impl Into<String>) -> Self

Available on crate feature router only.

Trusts origin to send state-changing cross-origin requests, exempting it from verify_origin.

The value is compared against the request’s Origin header, so pass the full serialized origin: scheme, host, and any non-default port ("https://accounts.example.com"), with no trailing slash.

Source

pub fn dangerous_disable_origin_verification(self) -> Self

Available on crate feature router only.

Disables the OriginLayer that the router’s sessions extension method registers.

Without the layer, nothing rejects state-changing cross-origin requests; only disable it if the application enforces its own defense against cross-site request forgery.

Source

pub fn build(self) -> SessionConfig

Consumes the builder, returning the finished SessionConfig.

§Panics

Panics when no token store was set and the default cookie store is unavailable because the cookie feature is disabled.

Trait Implementations§

Source§

impl Default for SessionConfigBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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, 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