-
Notifications
You must be signed in to change notification settings - Fork 6
861 bug when preferred username is not the email #862
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
861 bug when preferred username is not the email #862
Conversation
|
To replicate this bug, follow the instructions from this link to add a preferred_username field to a user. https://medium.com/@ramanamuttana/custom-attribute-in-keycloak-access-token-831b4be7384a Once you do that, and you try to log in as that user, you will see 'error user {preferred_username} not found.' on main. On this branch it should be fixed. |
PR looks good, but I am not sure I understand this comment. I think preferred_username is always there |
|
When I created users they didn't have the preferred_username field, so I found a way to add it so I could have the preferred_username not be the email and replicate the bug and test the fix. If you don't need to, then just edit the preferred_username in keycloak to make sure it's not the same as email. On main you'll see an error, but on this branch you won't. |
|
How can I test this PR? |
|
To test the PR, follow the instructions in the linked article to add "preferred_username" field to a user. Set the preferred username to something aside from the email. For me, users did not have 'preferred_username' field if they were created through clowder. On main, you'll see an error when logging in with that user, but on this branch the error is fixed. You can also just add the field for 1 user. |
longshuicy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good and works.
I think i know how to reproduce the error:
- Go to clients --> find clowder2-backend --> select "client scopes"
- select clowder2-backend-dedicate
- Mapper --> add mapper by configuration
- create a user attribute named "preferred_username"
- go back to a given user, add the "preferred_username" as a attribute and give it a different name
- You should expect failure with "main" branch; but success with this PR fix
|
Also confirming that this change work with our keycloak environment as well, thanks! |
ready for review. look at @longshuicy comment below to add the preferred_username