Skip to content
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

Validation of RegistrationEmailAsUsername attribute #438

Merged

Conversation

spirius
Copy link
Contributor

@spirius spirius commented Nov 18, 2020

Background:
I want to have a realm, where username and email attributes have same value, registration is disabled and user is allowed to manage own email address. To achieve this configuration keycloak can be configured as follows

RegistrationAllowed=false
RegistrationEmailAsUsername=true
EditUsernameAllowed=false

As a result, keycloak's account management page will allow user to manage own email address (but not username), and username will be updated automatically by keycloak upon change.

This configuration is of course not very intuitive, because RegistrationEmailAsUsername attribute should make sense only when registration is enabled, but in fact keycloak behaves just as described above. In order to achieve this from GUI, RegistrationAllowed can be temporary enabled / disabled, which will allow setting RegistrationEmailAsUsername to true.

Current implementation of the provider does not allow setting RegistrationEmailAsUsername to true when RegistrationAllowed is false, resulting in validation error: RegistrationEmailAsUsername cannot be true if RegistrationAllowed is false. This change removes that condition.

Copy link
Contributor

@mrparkers mrparkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me, thanks for the PR!

@mrparkers mrparkers merged commit a92a51f into keycloak:master Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants