Skip to content

Commit

Permalink
fix(auth): Fix parsing of REQUIRES_UPPERCASE/REQUIRES_LOWERCASE passw…
Browse files Browse the repository at this point in the history
…ord settings in Gen1 (#2836)
  • Loading branch information
mattcreaser authored Jun 3, 2024
1 parent e181875 commit e6aa829
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ data class AuthConfiguration internal constructor(
length = passwordLength,
requiresNumber = passwordRequirements.contains("REQUIRES_NUMBERS"),
requiresSpecial = passwordRequirements.contains("REQUIRES_SYMBOLS"),
requiresLower = passwordRequirements.contains("REQUIRES_LOWER"),
requiresUpper = passwordRequirements.contains("REQUIRES_UPPER")
requiresLower = passwordRequirements.contains("REQUIRES_LOWERCASE"),
requiresUpper = passwordRequirements.contains("REQUIRES_UPPERCASE")
)
}

private fun PasswordProtectionSettings.toGen1Json() = JSONObject().apply {
put("passwordPolicyMinLength", length)
val characters = JSONArray().apply {
if (requiresLower) put("REQUIRES_LOWER")
if (requiresUpper) put("REQUIRES_UPPER")
if (requiresLower) put("REQUIRES_LOWERCASE")
if (requiresUpper) put("REQUIRES_UPPERCASE")
if (requiresNumber) put("REQUIRES_NUMBERS")
if (requiresSpecial) put("REQUIRES_SYMBOLS")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class AuthConfigurationTest {
],
"passwordProtectionSettings": {
"passwordPolicyMinLength": 10,
"passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWER"]
"passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWERCASE"]
},
"mfaConfiguration": "OFF",
"mfaTypes": [
Expand Down

0 comments on commit e6aa829

Please sign in to comment.