Warm tip: This article is reproduced from stackoverflow.com, please click
keycloak

How to enable/disable user in Keycloak Admin Client

发布于 2020-04-21 10:33:47

In the examples I've found for the Keycloak Admin Client, a method called "setEnabled" in the UserRepresentation class is mentioned to enable/disable the user.

Unfortunately, this method seemed to be removed in the latest versions, as the method is also not listed in the JavaDocs anymore.

So, my question is: how can I enable/disable a user in the newest versions of the Keycloak Admin Client (3.4.3.Final)?

Thanks and best regards, Chris

Questioner
Chris R.
Viewed
183
Patrick Bucher 2018-08-27 17:28

It is clearly possible to do using the API:

curl -v -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $token" --data "{\"enabled\": false}" "http://localhost:8080/auth/admin/realms/[my-realm]/users/[user-id]"