summaryrefslogtreecommitdiff
path: root/internal/configuration/schema/password_policy.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2022-04-03 21:58:27 +1000
committerGitHub <noreply@github.com>2022-04-03 21:58:27 +1000
commit9e05066097e1b821649dad925ab4770f56d2fb43 (patch)
tree51d15a77ebac662c6366851c54ecc83a76cdb036 /internal/configuration/schema/password_policy.go
parent0f6ca55016def32f8478fb6028a4ac70ac4b0487 (diff)
refactor(handlers): ppolicy (#3103)
Add tests and makes the password policy a provider so the configuration can be loaded to memory on startup.
Diffstat (limited to 'internal/configuration/schema/password_policy.go')
-rw-r--r--internal/configuration/schema/password_policy.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/internal/configuration/schema/password_policy.go b/internal/configuration/schema/password_policy.go
index 9c24815e3..a87627f0f 100644
--- a/internal/configuration/schema/password_policy.go
+++ b/internal/configuration/schema/password_policy.go
@@ -2,7 +2,7 @@ package schema
// PasswordPolicyStandardParams represents the configuration related to standard parameters of password policy.
type PasswordPolicyStandardParams struct {
- Enabled bool
+ Enabled bool `koanf:"enabled"`
MinLength int `koanf:"min_length"`
MaxLength int `koanf:"max_length"`
RequireUppercase bool `koanf:"require_uppercase"`
@@ -13,8 +13,8 @@ type PasswordPolicyStandardParams struct {
// PasswordPolicyZxcvbnParams represents the configuration related to zxcvbn parameters of password policy.
type PasswordPolicyZxcvbnParams struct {
- Enabled bool
- MinScore int `koanf:"min_score"`
+ Enabled bool `koanf:"enabled"`
+ MinScore int `koanf:"min_score"`
}
// PasswordPolicyConfiguration represents the configuration related to password policy.
@@ -26,15 +26,12 @@ type PasswordPolicyConfiguration struct {
// DefaultPasswordPolicyConfiguration is the default password policy configuration.
var DefaultPasswordPolicyConfiguration = PasswordPolicyConfiguration{
Standard: PasswordPolicyStandardParams{
- Enabled: false,
- MinLength: 8,
- MaxLength: 0,
- RequireUppercase: true,
- RequireLowercase: true,
- RequireNumber: true,
- RequireSpecial: true,
+ Enabled: false,
+ MinLength: 8,
+ MaxLength: 0,
},
Zxcvbn: PasswordPolicyZxcvbnParams{
- Enabled: false,
+ Enabled: false,
+ MinScore: 0,
},
}