2019-04-24 21:52:08 +00:00
|
|
|
package handlers
|
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
const (
|
|
|
|
// ActionTOTPRegistration is the string representation of the action for which the token has been produced.
|
|
|
|
ActionTOTPRegistration = "RegisterTOTPDevice"
|
2019-04-24 21:52:08 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
// ActionU2FRegistration is the string representation of the action for which the token has been produced.
|
|
|
|
ActionU2FRegistration = "RegisterU2FDevice"
|
2019-04-24 21:52:08 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
// ActionResetPassword is the string representation of the action for which the token has been produced.
|
|
|
|
ActionResetPassword = "ResetPassword"
|
|
|
|
)
|
2019-04-24 21:52:08 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
const (
|
|
|
|
// HeaderProxyAuthorization is the basic-auth HTTP header Authelia utilises.
|
|
|
|
HeaderProxyAuthorization = "Proxy-Authorization"
|
2021-02-23 23:35:04 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
// HeaderAuthorization is the basic-auth HTTP header Authelia utilises with "auth=basic" query param.
|
|
|
|
HeaderAuthorization = "Authorization"
|
2020-12-01 23:03:44 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
// HeaderSessionUsername is used as additional protection to validate a user for things like pam_exec.
|
|
|
|
HeaderSessionUsername = "Session-Username"
|
2020-12-01 23:03:44 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
headerRemoteUser = "Remote-User"
|
|
|
|
headerRemoteName = "Remote-Name"
|
|
|
|
headerRemoteEmail = "Remote-Email"
|
|
|
|
headerRemoteGroups = "Remote-Groups"
|
|
|
|
)
|
2019-04-24 21:52:08 +00:00
|
|
|
|
|
|
|
const (
|
2020-04-20 21:03:38 +00:00
|
|
|
// Forbidden means the user is forbidden the access to a resource.
|
2019-04-24 21:52:08 +00:00
|
|
|
Forbidden authorizationMatching = iota
|
|
|
|
// NotAuthorized means the user can access the resource with more permissions.
|
|
|
|
NotAuthorized authorizationMatching = iota
|
|
|
|
// Authorized means the user is authorized given her current permissions.
|
|
|
|
Authorized authorizationMatching = iota
|
|
|
|
)
|
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
const (
|
|
|
|
messageOperationFailed = "Operation failed."
|
|
|
|
messageAuthenticationFailed = "Authentication failed. Check your credentials."
|
|
|
|
messageUnableToRegisterOneTimePassword = "Unable to set up one-time passwords." //nolint:gosec
|
|
|
|
messageUnableToRegisterSecurityKey = "Unable to register your security key."
|
|
|
|
messageUnableToResetPassword = "Unable to reset your password."
|
|
|
|
messageMFAValidationFailed = "Authentication failed, please retry later."
|
|
|
|
)
|
2020-11-27 09:59:22 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
const (
|
|
|
|
testInactivity = "10"
|
|
|
|
testRedirectionURL = "http://redirection.local"
|
|
|
|
testResultAllow = "allow"
|
|
|
|
testUsername = "john"
|
|
|
|
)
|
2020-05-20 22:03:15 +00:00
|
|
|
|
2021-07-22 03:52:37 +00:00
|
|
|
const (
|
|
|
|
loginDelayMovingAverageWindow = 10
|
|
|
|
loginDelayMinimumDelayMilliseconds = float64(250)
|
|
|
|
loginDelayMaximumRandomDelayMilliseconds = int64(85)
|
|
|
|
)
|
2021-05-04 22:06:05 +00:00
|
|
|
|
|
|
|
// OIDC constants.
|
|
|
|
const (
|
2021-07-22 03:52:37 +00:00
|
|
|
pathOpenIDConnectJWKs = "/api/oidc/jwks"
|
|
|
|
pathOpenIDConnectAuthorization = "/api/oidc/authorize"
|
|
|
|
pathOpenIDConnectToken = "/api/oidc/token" //nolint:gosec // This is not a hard coded credential, it's a path.
|
|
|
|
pathOpenIDConnectIntrospection = "/api/oidc/introspect"
|
|
|
|
pathOpenIDConnectRevocation = "/api/oidc/revoke"
|
|
|
|
pathOpenIDConnectUserinfo = "/api/oidc/userinfo"
|
2021-05-04 22:06:05 +00:00
|
|
|
|
|
|
|
// Note: If you change this const you must also do so in the frontend at web/src/services/Api.ts.
|
2021-07-22 03:52:37 +00:00
|
|
|
pathOpenIDConnectConsent = "/api/oidc/consent"
|
2021-05-04 22:06:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
accept = "accept"
|
|
|
|
reject = "reject"
|
|
|
|
)
|
2021-07-22 03:52:37 +00:00
|
|
|
|
|
|
|
const authPrefix = "Basic "
|
|
|
|
|
|
|
|
const ldapPasswordComplexityCode = "0000052D."
|
|
|
|
|
|
|
|
var ldapPasswordComplexityCodes = []string{
|
|
|
|
"0000052D", "SynoNumber", "SynoMixedCase", "SynoExcludeNameDesc", "SynoSpecialChar",
|
|
|
|
}
|
|
|
|
|
|
|
|
var ldapPasswordComplexityErrors = []string{
|
|
|
|
"LDAP Result Code 19 \"Constraint Violation\": Password fails quality checking policy",
|
|
|
|
"LDAP Result Code 19 \"Constraint Violation\": Password is too young to change",
|
|
|
|
}
|