KEYCLOAK-1971 REST end point does't validate password policies properly
This commit is contained in:
parent
ccd456dba6
commit
500bced6ee
2 changed files with 11 additions and 0 deletions
|
@ -76,6 +76,8 @@ public class PasswordPolicy implements Serializable {
|
||||||
list.add(new PasswordHistory(arg));
|
list.add(new PasswordHistory(arg));
|
||||||
} else if (name.equals(ForceExpiredPasswordChange.NAME)) {
|
} else if (name.equals(ForceExpiredPasswordChange.NAME)) {
|
||||||
list.add(new ForceExpiredPasswordChange(arg));
|
list.add(new ForceExpiredPasswordChange(arg));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Unsupported policy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -84,6 +84,15 @@ public class PasswordPolicyTest {
|
||||||
Assert.assertNull(policy.validate("jdoe", "ab&d1234"));
|
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
|
@Test
|
||||||
public void testRegexPatterns() {
|
public void testRegexPatterns() {
|
||||||
PasswordPolicy policy = null;
|
PasswordPolicy policy = null;
|
||||||
|
|
Loading…
Reference in a new issue