2020-05-02 16:20:40 +00:00
|
|
|
package schema
|
|
|
|
|
2020-05-04 19:39:25 +00:00
|
|
|
import (
|
2022-10-21 08:41:33 +00:00
|
|
|
"errors"
|
2022-07-05 04:43:12 +00:00
|
|
|
"regexp"
|
2020-05-04 19:39:25 +00:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2022-10-17 10:51:59 +00:00
|
|
|
const (
|
|
|
|
argon2 = "argon2"
|
|
|
|
argon2id = "argon2id"
|
|
|
|
sha512 = "sha512"
|
|
|
|
)
|
2020-05-06 00:52:06 +00:00
|
|
|
|
2022-10-21 08:41:33 +00:00
|
|
|
const (
|
|
|
|
// TLSVersion13 is the textual representation of TLS 1.3.
|
|
|
|
TLSVersion13 = "TLS1.3"
|
|
|
|
|
|
|
|
// TLSVersion12 is the textual representation of TLS 1.2.
|
|
|
|
TLSVersion12 = "TLS1.2"
|
|
|
|
|
|
|
|
// TLSVersion11 is the textual representation of TLS 1.1.
|
|
|
|
TLSVersion11 = "TLS1.1"
|
|
|
|
|
|
|
|
// TLSVersion10 is the textual representation of TLS 1.0.
|
|
|
|
TLSVersion10 = "TLS1.0"
|
|
|
|
|
|
|
|
// SSLVersion30 is the textual representation of SSL 3.0.
|
|
|
|
SSLVersion30 = "SSL3.0"
|
|
|
|
|
|
|
|
// Version13 is the textual representation of version 1.3.
|
|
|
|
Version13 = "1.3"
|
|
|
|
|
|
|
|
// Version12 is the textual representation of version 1.2.
|
|
|
|
Version12 = "1.2"
|
|
|
|
|
|
|
|
// Version11 is the textual representation of version 1.1.
|
|
|
|
Version11 = "1.1"
|
|
|
|
|
|
|
|
// Version10 is the textual representation of version 1.0.
|
|
|
|
Version10 = "1.0"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ErrTLSVersionNotSupported returned when an unknown TLS version supplied.
|
|
|
|
var ErrTLSVersionNotSupported = errors.New("supplied tls version isn't supported")
|
|
|
|
|
|
|
|
// ProfileRefreshDisabled represents a Value for refresh_interval that disables the check entirely.
|
2020-05-04 19:39:25 +00:00
|
|
|
const ProfileRefreshDisabled = "disable"
|
|
|
|
|
2022-03-13 02:51:23 +00:00
|
|
|
const (
|
2022-10-21 09:17:30 +00:00
|
|
|
// ProfileRefreshAlways represents a value for refresh_interval that's the same as 0ms.
|
2022-03-13 02:51:23 +00:00
|
|
|
ProfileRefreshAlways = "always"
|
2020-05-04 19:39:25 +00:00
|
|
|
|
2022-10-21 09:17:30 +00:00
|
|
|
// RefreshIntervalDefault represents the default value of refresh_interval.
|
2022-03-13 02:51:23 +00:00
|
|
|
RefreshIntervalDefault = "5m"
|
2020-05-04 19:39:25 +00:00
|
|
|
|
2022-10-21 09:17:30 +00:00
|
|
|
// RefreshIntervalAlways represents the duration value refresh interval should have if set to always.
|
2022-03-13 02:51:23 +00:00
|
|
|
RefreshIntervalAlways = 0 * time.Millisecond
|
|
|
|
)
|
2020-11-27 09:59:22 +00:00
|
|
|
|
2022-03-13 02:51:23 +00:00
|
|
|
const (
|
|
|
|
// LDAPImplementationCustom is the string for the custom LDAP implementation.
|
|
|
|
LDAPImplementationCustom = "custom"
|
2020-11-27 09:59:22 +00:00
|
|
|
|
2022-03-13 02:51:23 +00:00
|
|
|
// LDAPImplementationActiveDirectory is the string for the Active Directory LDAP implementation.
|
|
|
|
LDAPImplementationActiveDirectory = "activedirectory"
|
2022-12-21 10:07:00 +00:00
|
|
|
|
|
|
|
// LDAPImplementationFreeIPA is the string for the FreeIPA LDAP implementation.
|
|
|
|
LDAPImplementationFreeIPA = "freeipa"
|
2022-03-13 02:51:23 +00:00
|
|
|
)
|
2021-12-01 12:11:29 +00:00
|
|
|
|
|
|
|
// TOTP Algorithm.
|
|
|
|
const (
|
|
|
|
TOTPAlgorithmSHA1 = "SHA1"
|
|
|
|
TOTPAlgorithmSHA256 = "SHA256"
|
|
|
|
TOTPAlgorithmSHA512 = "SHA512"
|
|
|
|
)
|
|
|
|
|
2022-03-13 02:51:23 +00:00
|
|
|
const (
|
|
|
|
// RememberMeDisabled represents the duration for a disabled remember me session configuration.
|
|
|
|
RememberMeDisabled = time.Second * -1
|
|
|
|
)
|
|
|
|
|
2021-12-01 12:11:29 +00:00
|
|
|
var (
|
|
|
|
// TOTPPossibleAlgorithms is a list of valid TOTP Algorithms.
|
|
|
|
TOTPPossibleAlgorithms = []string{TOTPAlgorithmSHA1, TOTPAlgorithmSHA256, TOTPAlgorithmSHA512}
|
|
|
|
)
|
2022-04-07 23:01:01 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
// TOTPSecretSizeDefault is the default secret size.
|
|
|
|
TOTPSecretSizeDefault = 32
|
|
|
|
|
|
|
|
// TOTPSecretSizeMinimum is the minimum secret size.
|
|
|
|
TOTPSecretSizeMinimum = 20
|
|
|
|
)
|
2022-07-05 04:43:12 +00: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]+://`)
|
2022-10-02 02:07:40 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
blockCERTIFICATE = "CERTIFICATE"
|
|
|
|
blockRSAPRIVATEKEY = "RSA PRIVATE KEY"
|
|
|
|
)
|
2022-12-21 10:07:00 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
ldapAttrMail = "mail"
|
|
|
|
ldapAttrUserID = "uid"
|
|
|
|
ldapAttrDisplayName = "displayName"
|
|
|
|
ldapAttrCommonName = "cn"
|
|
|
|
)
|