Class LoginThrottle

Assembly: redb.Tsak.Web.dll

Per-login failed-attempt throttle for the dashboard sign-in (review item 2.6). After
failures within the window a login is locked out for
, defeating online password guessing. A successful login clears the
counter. Registered as a singleton so the state is shared across all requests on the node.
Pure and clock-injectable so lockout timing is unit-testable without waiting.

public sealed class LoginThrottle

Inheritance

Object→LoginThrottle

Properties

LockoutDuration

public TimeSpan LockoutDuration { get; }

MaxAttempts

public int MaxAttempts { get; }

Window

public TimeSpan Window { get; }

Methods

IsLockedOut(string)

True when key is currently locked out.

public bool IsLockedOut(string key)

RecordFailure(string, int?)

Record a failed attempt; may transition the key into lockout.

public void RecordFailure(string key, int? maxAttemptsOverride = null)

RecordSuccess(string)

Clear any failure/lockout state for key after a successful login.

public void RecordSuccess(string key)

Constructors