#[non_exhaustive]pub struct SessionConfig {
pub session_ttl_secs: u64,
pub cookie_name: String,
pub validate_fingerprint: bool,
pub touch_interval_secs: u64,
pub max_sessions_per_user: usize,
}Expand description
Configuration for the session middleware.
Deserialised from the session key in the application YAML config.
All fields have defaults, so an empty session: block is valid.
§YAML example
session:
session_ttl_secs: 2592000 # 30 days
cookie_name: "_session"
validate_fingerprint: true
touch_interval_secs: 300 # 5 minutes
max_sessions_per_user: 10Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.session_ttl_secs: u64Session lifetime in seconds. Defaults to 2_592_000 (30 days).
Name of the session cookie. Defaults to "_session".
validate_fingerprint: boolWhen true, the middleware rejects requests whose browser fingerprint
does not match the one recorded at login. Defaults to true.
touch_interval_secs: u64Minimum interval between last_active_at updates, in seconds.
A session is only touched when at least this many seconds have elapsed
since the last touch. Defaults to 300 (5 minutes).
max_sessions_per_user: usizeMaximum number of concurrent active sessions per user. When exceeded,
the least-recently-used session is evicted. Must be greater than zero.
Defaults to 10.
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionConfig
impl Debug for SessionConfig
Source§impl Default for SessionConfig
impl Default for SessionConfig
Source§impl<'de> Deserialize<'de> for SessionConfigwhere
SessionConfig: Default,
impl<'de> Deserialize<'de> for SessionConfigwhere
SessionConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionConfig
impl RefUnwindSafe for SessionConfig
impl Send for SessionConfig
impl Sync for SessionConfig
impl Unpin for SessionConfig
impl UnsafeUnpin for SessionConfig
impl UnwindSafe for SessionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more