[keycloak-user] Remove client roles containing slash using Admin Client/Admin REST API

Erdal, Jonatan jonatan.erdal at capgemini.com
Mon Sep 24 08:14:49 EDT 2018


Hi,

We are working on automatically removing client roles from one of our clients, but are struggeling with roles containing a slash, /.

Currently we are using the Keycloak Admin Client library for Java, org.keycloak.admin.client. To be more precise, we use the ClientResource to fetch the RolesResource, and we then use the method deleteRole(String rolename) ;

*         clientResource.roles().deleteRole(roleName)

We have tried both with and without URL Encoding (UTF-8). It works perfectly fine for roles not containing slash.

Example of role not working :

*         test/role
Example of role working:

*         test_role

We have also tried using the Admin REST API to remove the roles, but with the same result.
DELETE /admin/realms/{realm}/clients/{id}/roles/{role-name}

Both methods (Admin client and Admin REST API) returns status 404 for role test/test. Both methods works for other roles, such as test_test.

Does anyone know if it is possible to somehow remove roles containing slash without having to go to the admin console?

Thanks in advance!

//Jonatan

________________________________

Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini Sverige AB, a company registered in Sweden (number 556092-3053) whose registered office is at Gustavslundsv?gen 131 Box 825 ? S-161 24 Bromma.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


More information about the keycloak-user mailing list