pub struct FailureTracker { /* private fields */ }Expand description
Tracks authentication failures and enforces FIA_AFL.1 lockout.
Implementations§
Source§impl FailureTracker
impl FailureTracker
Sourcepub fn new(policy: LockoutPolicy) -> Self
pub fn new(policy: LockoutPolicy) -> Self
Create a tracker with the given policy.
Sourcepub fn policy(&self) -> &LockoutPolicy
pub fn policy(&self) -> &LockoutPolicy
The active policy.
Sourcepub fn check(&self, identity: &str) -> LockoutStatus
pub fn check(&self, identity: &str) -> LockoutStatus
Check whether identity is currently locked out, without recording an
attempt. Call this before validating a credential.
Sourcepub fn record_failure(&self, identity: &str) -> LockoutStatus
pub fn record_failure(&self, identity: &str) -> LockoutStatus
Record a failed authentication attempt for identity and return the
resulting status. A return of LockoutStatus::LockedOut means this
failure reached (or was already past) the threshold — the caller should
emit the FIA_AFL security-violation audit event.
Sourcepub fn record_success(&self, identity: &str)
pub fn record_success(&self, identity: &str)
Record a successful authentication for identity, clearing its failure
state. A success does not lift an active lockout — the credential is
still refused until the lockout expires — so we only drop the record
when it is not currently locked.
Auto Trait Implementations§
impl !Freeze for FailureTracker
impl !RefUnwindSafe for FailureTracker
impl Send for FailureTracker
impl Sync for FailureTracker
impl Unpin for FailureTracker
impl UnsafeUnpin for FailureTracker
impl UnwindSafe for FailureTracker
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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