From e6aa8298682d3a74341f603f757f9fdd49db0095 Mon Sep 17 00:00:00 2001 From: Matt Creaser Date: Mon, 3 Jun 2024 11:36:24 -0300 Subject: [PATCH] fix(auth): Fix parsing of REQUIRES_UPPERCASE/REQUIRES_LOWERCASE password settings in Gen1 (#2836) --- .../amplifyframework/auth/cognito/AuthConfiguration.kt | 8 ++++---- .../auth/cognito/AuthConfigurationTest.kt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/AuthConfiguration.kt b/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/AuthConfiguration.kt index d52badb07..9a3274dfb 100644 --- a/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/AuthConfiguration.kt +++ b/aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/AuthConfiguration.kt @@ -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") } diff --git a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/AuthConfigurationTest.kt b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/AuthConfigurationTest.kt index 915e7af2b..c5e2c6881 100644 --- a/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/AuthConfigurationTest.kt +++ b/aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/AuthConfigurationTest.kt @@ -73,7 +73,7 @@ class AuthConfigurationTest { ], "passwordProtectionSettings": { "passwordPolicyMinLength": 10, - "passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWER"] + "passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWERCASE"] }, "mfaConfiguration": "OFF", "mfaTypes": [