Class RateLimitOptions
C1 — Configuration for per-IP / per-(IP+username) rate limiting that sits in front of
/connect/token, /login, /mfa/verify, /mfa/recovery and
/mfa/methods routes.
public sealed class RateLimitOptions
Inheritance
Properties
Backend
Backing store identifier. "memory" (default) keeps counters per node;
public string Backend { get; set; }
DefaultRetryAfterSeconds
Value sent as the Retry-After header on 429 responses when the store cannot
public int DefaultRetryAfterSeconds { get; set; }
Enabled
Master switch. false = no rate-limit processors are wired into routes.
public bool Enabled { get; set; }
PerIpPerMinute
Per-IP requests-per-minute ceiling. Bucket = client IP (after C2 trust resolution).
public int PerIpPerMinute { get; set; }
PerIpUsernameFailures
Per-(IP+username) failure ceiling within .
public int PerIpUsernameFailures { get; set; }
PerIpUsernameWindow
Window for the per-(IP+username) failure counter. Default: 15 minutes.
public TimeSpan PerIpUsernameWindow { get; set; }
RedisConnectionString
StackExchange.Redis connection string used when is "redis".
public string? RedisConnectionString { get; set; }
RedisKeyPrefix
Optional prefix applied to Redis keys to scope counters per environment / tenant.
public string RedisKeyPrefix { get; set; }
Remarks
The per-IP limit drops distributed brute-force attempts pooled across many usernames; the
per-(IP+username) failure counter blocks credential-stuffing against a single account from
one source. They run orthogonally to the per-account lockout enforced inside
(B5/B6).
In-memory backend (default). A ConcurrentDictionary-backed sliding-window
counter PER NODE — across an N-node cluster the effective ceiling is N × limit
(acceptable trade-off for online brute-force; matches NGINX/Envoy node-local limits).
Redis backend (opt-in). Sliding window via a sorted set (ZADD/ZREMRANGEBYSCORE/
ZCARD/EXPIRE) executed atomically — gives a true global limit across the cluster but
adds one round-trip per gated request.