pub struct AuthConfig {Show 13 fields
pub user_model: Option<String>,
pub modules: Vec<AuthModule>,
pub strategies: Vec<String>,
pub jwt: Option<JwtConfig>,
pub oauth: HashMap<String, OAuthProviderConfig>,
pub two_factor: TwoFactorConfig,
pub timeout: u64,
pub password_length: usize,
pub maximum_attempts: u32,
pub unlock_in: i64,
pub reset_password_within: i64,
pub remember_for: i64,
pub routes: AuthRoutesConfig,
}Expand description
Full auth configuration deserialized from the auth section.
Fields§
§user_model: Option<String>§modules: Vec<AuthModule>§strategies: Vec<String>§jwt: Option<JwtConfig>§oauth: HashMap<String, OAuthProviderConfig>§two_factor: TwoFactorConfig§timeout: u64Idle-session timeout in seconds for the timeoutable module.
password_length: usizeMinimum password length enforced by the validatable module.
maximum_attempts: u32Failed sign-in attempts before lockable locks an account.
unlock_in: i64Seconds a lockable account stays locked before auto-unlocking.
reset_password_within: i64Seconds a recoverable password-reset token stays valid.
remember_for: i64Seconds a rememberable “remember me” cookie persists.
routes: AuthRoutesConfigImplementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn from_yaml(yaml: &str) -> Result<Self, Error>
pub fn from_yaml(yaml: &str) -> Result<Self, Error>
Parse from a YAML string containing an auth: section (other sections ignored).
Sourcepub fn has_module(&self, module: AuthModule) -> bool
pub fn has_module(&self, module: AuthModule) -> bool
Returns whether module is enabled.
Sourcepub fn enabled_route_groups(&self) -> Vec<&'static str>
pub fn enabled_route_groups(&self) -> Vec<&'static str>
The auth_routes! route-group names for the enabled modules, in a stable
order (sessions is always present for database_authenticatable). Used
to generate the only: list and to gate the runtime route mounter.
Sourcepub fn validate(&self) -> Result<(), AuthError>
pub fn validate(&self) -> Result<(), AuthError>
Validate required secrets, strategy-specific settings, and module coherence.
pub fn strategy_kinds(&self) -> Vec<StrategyKind>
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 moreSource§impl Debug for AuthConfig
impl Debug for AuthConfig
Source§impl Default for AuthConfig
impl Default for AuthConfig
Source§impl<'de> Deserialize<'de> for AuthConfig
impl<'de> Deserialize<'de> for AuthConfig
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>,
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnsafeUnpin for AuthConfig
impl UnwindSafe for AuthConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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> ⓘ
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