Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bulk update of users in KeyCloak

Tags:

java

keycloak

I have a task to change the status of users in the IDM. The solution I chose is naive: looping each one and calling KeyCloak's service using REST.

However, I've noticed that this consumes a lot of time. I thought that something like bulk update (equivalent to SQL) might solve the issue, but I didn't find it in KeyCloak's API.

Does anyone know how to fix it? Thanks for help!

like image 853
Aladin Avatar asked Oct 30 '22 11:10

Aladin


1 Answers

Do you have access to Keycloak's database? If that's the case, you may update users' data with SQL sentences. The schema is pretty straightforward to understand, I've made bulk updates in this fashion before.

What do you mean by "status"? If you mean the "enabled" status, your update will look like this:

UPDATE user_entity SET enabled = (value) WHERE (your conditions)

AFAIK, there's no way to bulk update through REST or the admin console.

Good luck!

like image 157
Alejandro Gianetti Avatar answered Nov 12 '22 19:11

Alejandro Gianetti