diff --git a/server-spi-private/src/main/java/org/keycloak/policy/RegexPatternsPasswordPolicyProvider.java b/server-spi-private/src/main/java/org/keycloak/policy/RegexPatternsPasswordPolicyProvider.java index cfcfbc538c..1a66020fbc 100644 --- a/server-spi-private/src/main/java/org/keycloak/policy/RegexPatternsPasswordPolicyProvider.java +++ b/server-spi-private/src/main/java/org/keycloak/policy/RegexPatternsPasswordPolicyProvider.java @@ -57,6 +57,8 @@ public class RegexPatternsPasswordPolicyProvider implements PasswordPolicyProvid public Object parseConfig(String value) { if (value == null) { throw new PasswordPolicyConfigException("Config required"); + } else if(value.trim().isEmpty()) { + throw new PasswordPolicyConfigException("White space not acepted"); } try { return Pattern.compile(value);