Struct salvo_session::HandlerBuilder
source · pub struct HandlerBuilder<S> { /* private fields */ }
Expand description
HandlerBuilder
Implementations§
source§impl<S> HandlerBuilder<S>where
S: SessionStore,
impl<S> HandlerBuilder<S>where
S: SessionStore,
Sets a cookie path for this session middleware.
The default for this value is “/”.
sourcepub fn session_ttl(self, session_ttl: Option<Duration>) -> Self
pub fn session_ttl(self, session_ttl: Option<Duration>) -> Self
Sets a session ttl. This will be used both for the cookie expiry and also for the session-internal expiry.
The default for this value is one day. Set this to None to not set a cookie or session expiry. This is not recommended.
Sets the name of the cookie that the session is stored with or in.
If you are running multiple tide applications on the same domain, you will need different values for each application. The default value is “salvo.session_id”.
sourcepub fn save_unchanged(self, value: bool) -> Self
pub fn save_unchanged(self, value: bool) -> Self
Sets the save_unchanged
value.
When save_unchanged
is enabled, a session will cookie will always be set.
With save_unchanged
disabled, the session data must be modified
from the Default
value in order for it to save. If a session
already exists and its data unmodified in the course of a
request, the session will only be persisted if
save_unchanged
is enabled.
sourcepub fn same_site_policy(self, policy: SameSite) -> Self
pub fn same_site_policy(self, policy: SameSite) -> Self
Sets the same site policy for the session cookie. Defaults to SameSite::Lax. See incrementally better cookies for more information about this setting.
Sets the domain of the cookie.
sourcepub fn fallback_keys(self, keys: Vec<impl Into<Key>>) -> Self
pub fn fallback_keys(self, keys: Vec<impl Into<Key>>) -> Self
Sets fallbacks.
sourcepub fn add_fallback_key(self, key: impl Into<Key>) -> Self
pub fn add_fallback_key(self, key: impl Into<Key>) -> Self
Add fallback secret.
sourcepub fn build(self) -> Result<SessionHandler<S>, Error>
pub fn build(self) -> Result<SessionHandler<S>, Error>
Build SessionHandler