# Custom Password Policies

**URL:** <https://forum.keycloak.org/t/custom-password-policies/22246>\
**Category:** Extending the server\
**Tags:** authentication\
**Created:** [May 22, 2023, 9:02am UTC](https://forum.keycloak.org/t/custom-password-policies/22246 "2023-05-22T09:02:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maheshbhise](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@maheshbhise](https://forum.keycloak.org/u/maheshbhise)\
**Post date:** [May 22, 2023, 9:02am UTC](https://forum.keycloak.org/t/custom-password-policies/22246/1 "2023-05-22T09:02:44Z")

</div>

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 **META-INF.services** 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!

---

<div class="post-metadata">

**Author:** ![tania](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tania/32/9460_2.png) [@tania](https://forum.keycloak.org/u/tania)\
**Post date:** [March 27, 2024, 10:27am UTC](https://forum.keycloak.org/t/custom-password-policies/22246/2 "2024-03-27T10:27:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maheshbhise](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@maheshbhise](https://forum.keycloak.org/u/maheshbhise)\
**Post date:** [March 27, 2024, 8:16pm UTC](https://forum.keycloak.org/t/custom-password-policies/22246/3 "2024-03-27T20:16:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tania](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tania/32/9460_2.png) [@tania](https://forum.keycloak.org/u/tania)\
**Post date:** [April 8, 2024, 8:20am UTC](https://forum.keycloak.org/t/custom-password-policies/22246/4 "2024-04-08T08:20:18Z")

</div>

Thank you very much!
