KEYCLOAK-11700 Lower-case passwords before checking with password blacklist
This commit is contained in:
parent
06576a44c9
commit
9a3a358b96
2 changed files with 2 additions and 1 deletions
|
@ -45,7 +45,7 @@ public class BlacklistPasswordPolicyProvider implements PasswordPolicyProvider {
|
||||||
|
|
||||||
PasswordBlacklist blacklist = (FileBasedPasswordBlacklist) policyConfig;
|
PasswordBlacklist blacklist = (FileBasedPasswordBlacklist) policyConfig;
|
||||||
|
|
||||||
if (!blacklist.contains(password)) {
|
if (!blacklist.contains(password.toLowerCase())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@ public class PasswordPolicyTest extends AbstractKeycloakTest {
|
||||||
|
|
||||||
Assert.assertEquals(BlacklistPasswordPolicyProvider.ERROR_MESSAGE, policyManager.validate("jdoe", "blacklisted1").getMessage());
|
Assert.assertEquals(BlacklistPasswordPolicyProvider.ERROR_MESSAGE, policyManager.validate("jdoe", "blacklisted1").getMessage());
|
||||||
Assert.assertEquals(BlacklistPasswordPolicyProvider.ERROR_MESSAGE, policyManager.validate("jdoe", "blacklisted2").getMessage());
|
Assert.assertEquals(BlacklistPasswordPolicyProvider.ERROR_MESSAGE, policyManager.validate("jdoe", "blacklisted2").getMessage());
|
||||||
|
Assert.assertEquals(BlacklistPasswordPolicyProvider.ERROR_MESSAGE, policyManager.validate("jdoe", "bLaCkLiSteD2").getMessage());
|
||||||
assertNull(policyManager.validate("jdoe", "notblacklisted"));
|
assertNull(policyManager.validate("jdoe", "notblacklisted"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue