pub struct AuthConfig {
pub jwt_secret: String,
pub session_ttl_secs: u64,
pub allow_registration: bool,
pub require_email_verification: Option<bool>,
pub allow_invitations: Option<bool>,
pub allow_password_reset: Option<bool>,
pub invite_ttl_secs: u64,
pub verification_ttl_secs: u64,
pub password_reset_ttl_secs: u64,
}Fields§
§jwt_secret: StringSecret used to sign session JWTs. Auto-generated (and warned about) when left empty — set it in production so tokens survive restarts.
session_ttl_secs: u64Session token lifetime in seconds.
allow_registration: boolAllow self-service signup on POST /auth/register.
require_email_verification: Option<bool>Require a new account to confirm its address before it can sign in.
Unset follows [email].
allow_invitations: Option<bool>Offer POST /auth/invitations, so an admin can add someone who has no
account yet. Unset follows [email].
allow_password_reset: Option<bool>Offer POST /auth/password/forgot and /auth/password/reset. Unset
follows [email].
invite_ttl_secs: u64How long an organisation invitation stays valid (default 7 days).
verification_ttl_secs: u64How long an address-confirmation link stays valid (default 24 hours).
password_reset_ttl_secs: u64How long a password-reset link stays valid (default 1 hour). Short on purpose: it is a live credential sitting in a mailbox.
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn requires_email_verification(&self, email_enabled: bool) -> bool
pub fn requires_email_verification(&self, email_enabled: bool) -> bool
Whether new accounts must confirm their address, given whether the app can send mail at all. An unset flag follows the mailer: asking for a confirmation nobody can deliver would lock every new account out.
Sourcepub fn invitations_enabled(&self, email_enabled: bool) -> bool
pub fn invitations_enabled(&self, email_enabled: bool) -> bool
Whether invitations are offered. See
requires_email_verification for
why an explicit true still needs a mailer.
Sourcepub fn password_reset_enabled(&self, email_enabled: bool) -> bool
pub fn password_reset_enabled(&self, email_enabled: bool) -> bool
Whether password reset is offered.
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more