Keycloak Remove First Name and Last Name fields on

2020-07-23 07:13发布

问题:

In Keycloak we have a created a custom ftl registration theme that has removed the optional first name and last name fields. Our system only requires the user to have an email address and password.

However when the user hits enter an error is displayed indicating that the first name and last name need to be entered.

In the Keycloak UserModel these fields are optional, and it is also possible to create users via the admin console / api without firstname and lastname.

How do we remove these fields from the keycloak form validation on the registration screen?

回答1:

Profile Validation can be disabled from the Authentication -> Flows area in the Admin Console.

Changing the dropdown option to 'Registration' will display the actions used on the Registration Form. Setting 'Profile Validation' to DISABLED will prevent the RegistrationProfile Form Action from being used.

This will prevent all 3 fields (First Name, Last Name & Email) from being checked, you would probably need to implement your own validation action if you wanted more control over which fields to check.