2020-05-02 23:20:40 +07:00
|
|
|
package schema
|
|
|
|
|
2020-05-05 02:39:25 +07:00
|
|
|
import (
|
2022-07-05 11:43:12 +07:00
|
|
|
"regexp"
|
2020-05-05 02:39:25 +07:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-05-06 07:52:06 +07:00
|
|
|
const argon2id = "argon2id"
|
|
|
|
|
2020-05-05 02:39:25 +07:00
|
|
|
// ProfileRefreshDisabled represents a value for refresh_interval that disables the check entirely.
|
|
|
|
const ProfileRefreshDisabled = "disable"
|
|
|
|
|
2022-03-13 09:51:23 +07:00
|
|
|
const (
|
|
|
|
// ProfileRefreshAlways represents a value for refresh_interval that's the same as 0ms.
|
|
|
|
ProfileRefreshAlways = "always"
|
2020-05-05 02:39:25 +07:00
|
|
|
|
2022-03-13 09:51:23 +07:00
|
|
|
// RefreshIntervalDefault represents the default value of refresh_interval.
|
|
|
|
RefreshIntervalDefault = "5m"
|
2020-05-05 02:39:25 +07:00
|
|
|
|
2022-03-13 09:51:23 +07:00
|
|
|
// RefreshIntervalAlways represents the duration value refresh interval should have if set to always.
|
|
|
|
RefreshIntervalAlways = 0 * time.Millisecond
|
|
|
|
)
|
2020-11-27 16:59:22 +07:00
|
|
|
|
2022-03-13 09:51:23 +07:00
|
|
|
const (
|
|
|
|
// LDAPImplementationCustom is the string for the custom LDAP implementation.
|
|
|
|
LDAPImplementationCustom = "custom"
|
2020-11-27 16:59:22 +07:00
|
|
|
|
2022-03-13 09:51:23 +07:00
|
|
|
// LDAPImplementationActiveDirectory is the string for the Active Directory LDAP implementation.
|
|
|
|
LDAPImplementationActiveDirectory = "activedirectory"
|
|
|
|
)
|
2021-12-01 19:11:29 +07:00
|
|
|
|
|
|
|
// TOTP Algorithm.
|
|
|
|
const (
|
|
|
|
TOTPAlgorithmSHA1 = "SHA1"
|
|
|
|
TOTPAlgorithmSHA256 = "SHA256"
|
|
|
|
TOTPAlgorithmSHA512 = "SHA512"
|
|
|
|
)
|
|
|
|
|
2022-03-13 09:51:23 +07:00
|
|
|
const (
|
|
|
|
// RememberMeDisabled represents the duration for a disabled remember me session configuration.
|
|
|
|
RememberMeDisabled = time.Second * -1
|
|
|
|
)
|
|
|
|
|
2021-12-01 19:11:29 +07:00
|
|
|
var (
|
|
|
|
// TOTPPossibleAlgorithms is a list of valid TOTP Algorithms.
|
|
|
|
TOTPPossibleAlgorithms = []string{TOTPAlgorithmSHA1, TOTPAlgorithmSHA256, TOTPAlgorithmSHA512}
|
|
|
|
)
|
2022-04-08 06:01:01 +07:00
|
|
|
|
|
|
|
const (
|
|
|
|
// TOTPSecretSizeDefault is the default secret size.
|
|
|
|
TOTPSecretSizeDefault = 32
|
|
|
|
|
|
|
|
// TOTPSecretSizeMinimum is the minimum secret size.
|
|
|
|
TOTPSecretSizeMinimum = 20
|
|
|
|
)
|
2022-07-05 11:43:12 +07:00
|
|
|
|
|
|
|
// regexpHasScheme checks if a string has a scheme. Valid characters for schemes include alphanumeric, hyphen,
|
|
|
|
// period, and plus characters.
|
|
|
|
var regexpHasScheme = regexp.MustCompile(`^[-+.a-zA-Z\d]+://`)
|