Merge pull request #1861 from stianst/KEYCLOAK-1971
KEYCLOAK-1971 REST end point does't validate password policies properly
This commit is contained in:
commit
94ba87ac05
2 changed files with 11 additions and 0 deletions
|
@ -76,6 +76,8 @@ public class PasswordPolicy implements Serializable {
|
|||
list.add(new PasswordHistory(arg));
|
||||
} else if (name.equals(ForceExpiredPasswordChange.NAME)) {
|
||||
list.add(new ForceExpiredPasswordChange(arg));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unsupported policy");
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -83,6 +83,15 @@ public class PasswordPolicyTest {
|
|||
Assert.assertEquals("invalidPasswordNotUsernameMessage", policy.validate("jdoe", "jdoe").getMessage());
|
||||
Assert.assertNull(policy.validate("jdoe", "ab&d1234"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidPolicyName() {
|
||||
try {
|
||||
PasswordPolicy policy = new PasswordPolicy("noSuchPolicy");
|
||||
Assert.fail("Expected exception");
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegexPatterns() {
|
||||
|
|
Loading…
Reference in a new issue