Make usernames UPPERCASE in Keycloak v25+

I’m new to Keycloak and something that should probably be a few minutes, is taking me days and can’t find a working solution.
I’m importing users to Keycloak from Laravel, via API calls. The problem is that Keycloak forces usernames to be lowercase, and in my case I need usernames to be exactly as I input them (uppercase, lowercase or capitalized).
GPT is too dumb to solve anything Keycloak related so that’s not helpful. I tried to make a custom user provider but couldn’t make it work, endless errors and wouldn’t compile.
Is there an easy way to make Keycloak accept usernames exactly as I enter them and not force lowercase?

As you have found, case-sensitive usernames are currently not supported, and creating a custom provider won’t allow you to override that.

Is the problem that you have usernames like UsErNaMe and userName that represent 2 distinct users in your system that you’re importing from?

Or are you just worried about the input on login? Because any case should be accepted in the login forms and then lower-cased before lookup.

1 Like

Yes, thank you. I just found out about this by testing the login form and I was able to login. So I came back here to comment just that and found your reply that confirms this is the expected behaviour.

I was just worried that users would not be able to login if they entered uppercase username but didn’t really test that until now. I was just expecting to store the username as uppercase.

So my case is resolved and I have wasted lots of time and some hair trying to fix something that I didn’t need fixing :upside_down_face:

1 Like