pub struct LockConfig {
pub max_attempts: u32,
pub lockout_duration: Duration,
pub attempt_window: Duration,
pub reset_on_success: bool,
pub progressive_lockout: bool,
pub max_lockout_duration: Duration,
pub permanent_lock_threshold: Option<u32>,
}Expand description
Account lock configuration.
Fields§
§max_attempts: u32Maximum failed attempts before locking
lockout_duration: DurationDuration to lock the account
attempt_window: DurationWindow for counting failed attempts
reset_on_success: boolWhether to reset attempts after successful login
progressive_lockout: boolWhether to use progressive lockout (longer each time)
max_lockout_duration: DurationMaximum lockout duration for progressive lockout
permanent_lock_threshold: Option<u32>Number of consecutive lockouts before permanent lock
Implementations§
Source§impl LockConfig
impl LockConfig
Sourcepub fn new() -> LockConfig
pub fn new() -> LockConfig
Create a new lock configuration with default values.
Sourcepub fn max_attempts(self, attempts: u32) -> LockConfig
pub fn max_attempts(self, attempts: u32) -> LockConfig
Set maximum failed attempts before locking.
Sourcepub fn lockout_duration(self, duration: Duration) -> LockConfig
pub fn lockout_duration(self, duration: Duration) -> LockConfig
Set lockout duration.
Sourcepub fn attempt_window(self, window: Duration) -> LockConfig
pub fn attempt_window(self, window: Duration) -> LockConfig
Set the window for counting failed attempts.
Sourcepub fn reset_on_success(self, reset: bool) -> LockConfig
pub fn reset_on_success(self, reset: bool) -> LockConfig
Set whether to reset attempts on successful login.
Sourcepub fn progressive_lockout(self, enabled: bool) -> LockConfig
pub fn progressive_lockout(self, enabled: bool) -> LockConfig
Enable/disable progressive lockout.
Sourcepub fn max_lockout_duration(self, duration: Duration) -> LockConfig
pub fn max_lockout_duration(self, duration: Duration) -> LockConfig
Set maximum lockout duration for progressive lockout.
Sourcepub fn permanent_lock_threshold(self, threshold: Option<u32>) -> LockConfig
pub fn permanent_lock_threshold(self, threshold: Option<u32>) -> LockConfig
Set threshold for permanent lock (None to disable).
Sourcepub fn strict() -> LockConfig
pub fn strict() -> LockConfig
Create a strict configuration for sensitive applications.
Sourcepub fn lenient() -> LockConfig
pub fn lenient() -> LockConfig
Create a lenient configuration for user-friendly applications.
Trait Implementations§
Source§impl Clone for LockConfig
impl Clone for LockConfig
Source§fn clone(&self) -> LockConfig
fn clone(&self) -> LockConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LockConfig
impl Debug for LockConfig
Source§impl Default for LockConfig
impl Default for LockConfig
Source§fn default() -> LockConfig
fn default() -> LockConfig
Auto Trait Implementations§
impl Freeze for LockConfig
impl RefUnwindSafe for LockConfig
impl Send for LockConfig
impl Sync for LockConfig
impl Unpin for LockConfig
impl UnwindSafe for LockConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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