pub struct SharedCredentialAttemptState { /* private fields */ }Expand description
Caller-owned concurrent lockout state for one credential lifecycle.
Cloned clients share this object by reference. Multiple attempt proofs may
begin on one open generation, but Self::reserve_dispatch admits only one
in-flight request. The first authentication rejection closes that
generation for every later execution. Only replacement credentials or an
explicit CredentialReconfirmation advance to a new open generation.
Implementations§
Sourcepub fn observe(&self) -> (CredentialAttemptGeneration, CredentialAttemptStatus)
pub fn observe(&self) -> (CredentialAttemptGeneration, CredentialAttemptStatus)
Returns the current generation and status.
Sourcepub fn begin(&self) -> Result<CredentialAttempt<'_>, CredentialAttemptError>
pub fn begin(&self) -> Result<CredentialAttempt<'_>, CredentialAttemptError>
Begins execution only when the current generation remains open.
Sourcepub fn validate(
&self,
attempt: CredentialAttempt<'_>,
) -> Result<(), CredentialAttemptError>
pub fn validate( &self, attempt: CredentialAttempt<'_>, ) -> Result<(), CredentialAttemptError>
Revalidates an attempt immediately before credential use.
Sourcepub fn reserve_dispatch(
&self,
attempt: CredentialAttempt<'_>,
) -> Result<CredentialDispatchGuard<'_>, CredentialAttemptError>
pub fn reserve_dispatch( &self, attempt: CredentialAttempt<'_>, ) -> Result<CredentialDispatchGuard<'_>, CredentialAttemptError>
Exclusively admits one dispatch for the supplied open generation.
Sourcepub fn reject(
&self,
attempt: CredentialAttempt<'_>,
) -> Result<(), CredentialAttemptError>
pub fn reject( &self, attempt: CredentialAttempt<'_>, ) -> Result<(), CredentialAttemptError>
Closes the exact generation that received authentication rejection.
Repeated concurrent rejection reports for the same generation are idempotent. A stale report cannot close replacement credentials.
Sourcepub fn replace(
&self,
expected: CredentialAttemptGeneration,
) -> Result<CredentialAttemptGeneration, CredentialAttemptError>
pub fn replace( &self, expected: CredentialAttemptGeneration, ) -> Result<CredentialAttemptGeneration, CredentialAttemptError>
Opens a new generation after replacement credentials were admitted.
Sourcepub fn reconfirm(
&self,
expected: CredentialAttemptGeneration,
_acknowledgement: CredentialReconfirmation,
) -> Result<CredentialAttemptGeneration, CredentialAttemptError>
pub fn reconfirm( &self, expected: CredentialAttemptGeneration, _acknowledgement: CredentialReconfirmation, ) -> Result<CredentialAttemptGeneration, CredentialAttemptError>
Opens a new generation after explicit unchanged-credential confirmation.