Set Password Polices

Hi,

I need help related password policy concept “Keycloak 21.0.2”.

I am trying to set password polices by using spring boot.

  1. When I use only single password policy like digits(1) its update on Keycloak.
  2. When I use multiple password polices then it override another one and set last one password policy in Keycloak.
  3. I make list of polices and tried then it set only last polices in list.

Example:
1.“realmRepresentation.setPasswordPolicy (“digits(1)”). (Working for single policy)
2.realmRepresentation.setPasswordPolicy(“digits(1),length(8),lowerCase(1),upperCase(1),specialChars(1))”)” (Its shows error)

How can I set Password Polices now ?
I just need proper way to set password policy please help.

Thank you!

To set password polices we have to use and operator rather than comma.

Example:
realmRepresentation.setPasswordPolicy(“length(8) and digits(1) and lowerCase(1) and upperCase(1) and specialChars(1)”).

Hi all,
I have a custom provider and i apply to the realm the minimum length of the password
“passwordPolicy”: “length(15)”.

When i am testing it, with existing users and new users with password with less than 15 characters, it is considered as valid, which is wrong.

What kind of check should apply on the updateCredentials method in order to have the expected behaviour?

Thank you in advance.