Custom Password Policies

Hi All,

I am trying to add custom password policies on Keycloak, As per the procedure I make a new project and in this project create a package policy and class RepetitiveCharacterPolicyProvider which implements PasswordPolicyProvider.

After that, I make a new directory in resources, and after that created a file org.keycloak.policy.PasswordPolicyProviderFactory name, In this file I have provided the file path “com.demo.custom.policy.RepetitiveCharacterPolicyProvider”.

I make a jar file for this project and copy this file and paste it to my Keycloak providers folder and run the Keycloak server, But the policy is not showing on Keycloak.
Where I am doing a mistake, Please help me with this concept.

Thank you!

Hi @maheshbhise ,
Did you find a solution on this?

Hi @tania ,
I’ve managed to find the solution to the issue.

Following the procedure I outlined earlier should work. However, it’s crucial to ensure that you’re using the correct Keycloak version and dependencies. When you align the versions appropriately, the custom password policy should appear in Keycloak as expected.

For instance, if you’re utilizing Keycloak version 21.0.1, ensure that you’re using the corresponding dependencies for this version.

Thank you very much!