Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preventing user from modifying their name in Keycloak

Tags:

keycloak

In Keycloak, by default, users are able to change their first and last name in the account manager page. Is it possible to disable this behavior? Removing both fields in the theme results in those values not being sent and the form failing, and a hand-crafted POST request would defeat this method anyway.

like image 785
Josselin Poiret Avatar asked Aug 16 '19 17:08

Josselin Poiret


2 Answers

I came across a similar problem and after reading this SO post, came to know that although you can disable/hide fields in ftl, you cannot disable form validation

For e.g I hid firstname field , but still cannot submit. Same was the result with disable as well: enter image description here

enter image description here

I am not aware about disabling a particular field in some other way. However there is a workaround in which you can disable the entire account modification flow (Password can still be changed by Forgot Password option).

Bu default, account modification is enabled, but you can disable it for a particular realm by going to Realms -> Clients -> Account.

enter image description here

The result of this will be, the account page will be inaccessible:

enter image description here

like image 58
tryingToLearn Avatar answered Sep 20 '22 21:09

tryingToLearn


You can remove the client role 'manage_account' for client 'account'.enter image description here

like image 34
loaded02 Avatar answered Sep 19 '22 21:09

loaded02