authelia/internal/regulation/types.go
James Elliott 3695aa8140
feat(storage): primary key for all tables and general qol refactoring (#2431)
This is a massive overhaul to the SQL Storage for Authelia. It facilitates a whole heap of utility commands to help manage the database, primary keys, ensures all database requests use a context for cancellations, and paves the way for a few other PR's which improve the database.

Fixes #1337
2021-11-23 20:45:38 +11:00

25 lines
685 B
Go

package regulation
import (
"time"
"github.com/authelia/authelia/v4/internal/storage"
"github.com/authelia/authelia/v4/internal/utils"
)
// Regulator an authentication regulator preventing attackers to brute force the service.
type Regulator struct {
// Is the regulation enabled.
enabled bool
// The number of failed authentication attempt before banning the user
maxRetries int
// If a user does the max number of retries within that duration, she will be banned.
findTime time.Duration
// If a user has been banned, this duration is the timelapse during which the user is banned.
banTime time.Duration
storageProvider storage.RegulatorProvider
clock utils.Clock
}