pub struct SessionMiddlewareConfig {
pub cookie_name: String,
pub cookie_domain: Option<String>,
pub cookie_path: String,
pub cookie_http_only: bool,
pub cookie_secure: bool,
pub cookie_same_site: CookieSameSite,
pub require_csrf: bool,
pub skip_paths: Vec<String>,
pub optional: bool,
}Expand description
Session middleware configuration
Fields§
Cookie name for session ID
Session cookie domain
Session cookie path
Whether session cookie is HTTP-only
Whether session cookie is secure (HTTPS only)
Session cookie SameSite attribute
require_csrf: boolRequire CSRF protection for session
skip_paths: Vec<String>Paths to skip authentication
optional: boolWhether authentication is optional (doesn’t fail if no session)
Implementations§
Source§impl SessionMiddlewareConfig
impl SessionMiddlewareConfig
Set cookie name
Set cookie domain
Set cookie path
Set whether cookie is HTTP-only
Set whether cookie is secure
Set cookie SameSite attribute
Sourcepub fn require_csrf(self, require: bool) -> Self
pub fn require_csrf(self, require: bool) -> Self
Set whether CSRF protection is required
Sourcepub fn skip_paths(self, paths: Vec<String>) -> Self
pub fn skip_paths(self, paths: Vec<String>) -> Self
Add paths to skip authentication
Sourcepub fn production() -> Self
pub fn production() -> Self
Production-ready configuration
Sourcepub fn development() -> Self
pub fn development() -> Self
Development configuration
Trait Implementations§
Source§impl Clone for SessionMiddlewareConfig
impl Clone for SessionMiddlewareConfig
Source§fn clone(&self) -> SessionMiddlewareConfig
fn clone(&self) -> SessionMiddlewareConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SessionMiddlewareConfig
impl Debug for SessionMiddlewareConfig
Auto Trait Implementations§
impl Freeze for SessionMiddlewareConfig
impl RefUnwindSafe for SessionMiddlewareConfig
impl Send for SessionMiddlewareConfig
impl Sync for SessionMiddlewareConfig
impl Unpin for SessionMiddlewareConfig
impl UnsafeUnpin for SessionMiddlewareConfig
impl UnwindSafe for SessionMiddlewareConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more