# How to configure the Username Policy

**URL:** <https://forum.keycloak.org/t/how-to-configure-the-username-policy/27319>\
**Category:** Getting advice\
**Created:** [August 5, 2024, 7:02pm UTC](https://forum.keycloak.org/t/how-to-configure-the-username-policy/27319 "2024-08-05T19:02:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abeldlfa1](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Abeldlfa1](https://forum.keycloak.org/u/Abeldlfa1)\
**Post date:** [August 5, 2024, 7:02pm UTC](https://forum.keycloak.org/t/how-to-configure-the-username-policy/27319/1 "2024-08-05T19:02:09Z")

</div>

I am currently required to configure the **Username** and **Password** policy from the KeyCloak app.

Surely, I could configure the **Password Policy** , from the **Authenticatio → Password Policy Screen**. However, I could not find the screen to configure the **Username Policy**.

I found that **KeyCloak** does not have the configuration to achieve it. this means KeyCloak does not have restrictions on username (as you can see in this link: [https://github.com/keycloak/keycloak/issues/9443](https://github.com/keycloak/keycloak/issues/9443)), however, this input is older, and honesty I do not know if this feature was included after this question.

My requirement is associated with:

1. Username Minimum Length.
2. Requires at least one number in Username.

We are using the KeyCloak version 9.0.2.

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [August 5, 2024, 7:04pm UTC](https://forum.keycloak.org/t/how-to-configure-the-username-policy/27319/2 "2024-08-05T19:04:04Z")

</div>

You need to upgrade to version `25` immediately. There are several known and exploitable CVEs for something as old as version `9`.

As an added benefit, you will find the new Declarative User Profile feature in this version, which allows you to create rules around different user attributes, including username.
