The use case
when a user changes some personal info (first name, last name, etc.) using the account client the data is posted to either
- org.keycloak.services.resources.account.AccountFormService.processAccountUpdate(MultivaluedMap<String, String>)
- org.keycloak.services.resources.account.AccountRestService.updateAccount(UserRepresentation)
,depending on if the old Freemarker client or the new React client is used.
What I would like to do is extend those methods to add some functionality that calls an external service before saving any user data.
The problem
It seems those classes are somewhat baked into the code and aren’t easily replaced or extended, without resorting to compiling your own distribution - which I would like to avoid.
The question
How should I go about implementing my own account update logic?
There are 3 approaches I can think of:
- There is a way to extended those classes, I am not familiar with
- I add my own custom endpoint (simply extending the existing AccountService classes) to Keycloak and make a small adjustment to the account client, to post to that one instead
- I completely abandon the account client and build a separate client app, which uses the Admin REST API as needed
Which approach would you recommend? Is there another better approach?
Thanks, for taking the time to read my query.