photoprism/internal/server/limiter/auth.go
Michael Mayer 838adee3eb Backend: Refactor middleware naming and improve code comments #5235
Signed-off-by: Michael Mayer <michael@photoprism.app>
2025-09-30 23:25:53 +02:00

16 lines
499 B
Go

package limiter
import (
"time"
"golang.org/x/time/rate"
)
// Default authentication rate-limit parameters.
const (
DefaultAuthInterval = time.Second * 10 // average authentication errors per second
DefaultAuthLimit = 60 // authentication failure burst rate limit (for access tokens)
)
// Auth limits the number of authentication errors from a single IP per time interval (every 15 seconds by default).
var Auth = NewLimit(rate.Every(DefaultAuthInterval), DefaultAuthLimit)