pub struct AuthConfig<'a> {
pub cookie_name: &'a str,
pub persistent_secret: Key,
pub token_config: Option<TokenConfig>,
pub cookie_expires: Option<Duration>,
}
Expand description
Configuration for AuthLayer and AuthMiddleware.
Fields§
The cookie name
This is the name of the cookie stored in the clients’ browsers.
persistent_secret: Key
A long lived secret used to sign cookies set to the users.
The secret is not shared with users.
All issued session keys are valid as long as the persistent secret is unchanged. There is no mechanism to invalidate individual sessions.
token_config: Option<TokenConfig>
The authentication token value and its configuration.
Set to None
if the entire connection is trusted (e.g. it is on a
loopback interface). In this case, token checking is disabled but still
SessionKey is still provided by AuthMiddleware.
If set, the newly set cookie has an Expires field which corresponds the
value set in expires
. If not set, the cookie does not have an
“Expires” (or “Max-Age”) field and consequently is typically stored as a
“session cookie” and thus saved only until the browser quits.
Note that this does not limit the validity duration of the session key. All issued session keys are valid as long as the persistent secret is unchanged. There is no mechanism to invalidate individual sessions.
Implementations§
Source§impl AuthConfig<'_>
impl AuthConfig<'_>
Sourcepub fn into_layer(self) -> AuthLayer
pub fn into_layer(self) -> AuthLayer
Trait Implementations§
Source§impl<'a> Clone for AuthConfig<'a>
impl<'a> Clone for AuthConfig<'a>
Source§fn clone(&self) -> AuthConfig<'a>
fn clone(&self) -> AuthConfig<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more