How to configure the Username Policy

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), 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.

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.

4 Likes