2019-04-25 04:52:08 +07:00
|
|
|
package regulation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2019-11-17 17:47:07 +07:00
|
|
|
"github.com/clems4ever/authelia/internal/storage"
|
2019-04-25 04:52:08 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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.Provider
|
|
|
|
}
|