-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Username with uppercase letters causing errors #138
Comments
Hello, That's a bit concerning! From what I understand, the username still has the correct case by the time we reach Ergo, signs point to your instance of Keycloak changing the case - are you sure you haven't configured Keycloak to force lowercase? I haven't used it in a while, so I'm not entirely sure how or where that could be done. Are you able to reproduce this behavior via a Cypress test, using the provided dockerized Keycloak? |
I'm not aware of any config we did in the team to force the case. I'll try to reproduce using cypress. |
I can confirm that the e2e tests are failing using the provided docker compose 😬 And I got the same logs as well. I've updated the Test before changeCode changes![]() Tests after change![]() ![]() Log trace
|
Thank you for doing the work to document the issue and reproduce it! From what I see in the logs, the first and last test cases are fine - the user is not found at all, so nothing is created in Keycloak. This will need some investigating to find the root cause of the case change, so that it can (hopefully) be fixed without workarounds. Unfortunately, I can't guarantee when I'll have the time to sit down with the code and provide a fix. If anyone else feels like it, though, more help is always appreciated :) |
A (very) quick Google led me to this Stack Overflow issue: Which points to this piece of Keycloak code: It seems like converting all usernames to lowercase in the plugin might be the correct way to go... Edit: Apparently, "Case-sensitive usernames and emails are currently not supported": At least the fix should be trivial, then, once I (or anyone else) get around to it. |
Any progress on this? We are having the same issue with wordpress usernames that have uppercase letters |
Unfortunately, I didn't have the time to fix this yet. However, I encourage you to create a Pull Request with the fix, if it's a pressing issue :) |
As a local work-around: I added a small REST service in between the legacy system and Keycloak. There the usernames are lower-cases before sending them to the keycloak-user-migration User Federation. Hence, the following happens:
|
Summary
TL;DR: Error migrating users to keycloak when the username is not all lowercase.
In our API, given a user with username
[email protected]
(we're using the email as username).When they're first migrated to keycloak using the provider, we got the following error in the logs
The user is created in keycloak, but the only info they have is the username, everything else is blank.
Steps to reproduce
What you expected would happen
The user with username
[email protected]
is created on keycloak with all the information provided on the json from the API (even a username[email protected]
would be accepted in this case)What actually happens
A user is created on keycloak with the username
[email protected]
with the statusdisabled
, no other information is migrated (email, firstname, lastname, attributes, credentials, ...)The user is not able to login.
Notes
We've tracked it to this part of code
As a hack, we're now forcing the username to be all lowercase in the GET api, and it's working fine.
The text was updated successfully, but these errors were encountered: