mirror of
https://github.com/go-sigma/sigma.git
synced 2026-10-28 15:34:34 +08:00
Add a cache-backed failed-login throttler for Basic auth. Once a username reaches auth.loginRateLimit.maxFailures failures within window, each subsequent authentication attempt is delayed by delay (capped at 5s) instead of being rejected; the counter is cleared on a successful login. - add pkg/infra/ratelimit backed by pkg/infra/cache (inmemory/redis) with Count/Incr/Reset and Prometheus metrics for failures, delayed attempts, and cache errors - wire ConfigurationAuthLoginRateLimit with defaults (5 failures, 5m window, 1s delay) and document it in conf/config.yaml - integrate the limiter into the authn middleware, counting all Basic failures including /v2/, and honor request context cancellation - add unit tests for threshold behavior, delay, and cancellation - mark the login rate limit item complete in TODO.md