[keycloak-user] Can't get roles of user via REST

Patrick Andreas Näf p.naef at naef-itcom.ch
Fri Sep 11 07:17:20 EDT 2015


Hi everybody

Started with the example:
https://github.com/keycloak/keycloak/blob/master/examples/demo-template/admin-access-app/src/main/java/org/keycloak/example/AdminClient.java 

That worked.

Then tried to get also the other interfaces.
Also that works:
/auth/admin/realms/REALM/users
But i don't get the roles of the user here.
So i think the permissions are there, i can get data.

If i try this:
/auth/admin/realms/REALM/users/NAME_OF_USER/role-mappings

i get an 404 error.
my code is:
String url = 
"http://localhost:8081/auth/admin/realms/REALM/users/NAME_OF_USER/role-mappings"; 

HttpGet get = new HttpGet(url);
get.addHeader("Authorization", "Bearer " + res.getToken());
HttpResponse response = client.execute(get);


if i open the same url in the browser i see "Bearer", what is logic to 
me and it shows that the server is there and the url is correct.

Keycloak version is 1.3.1.Final
Java: 8

Thanks a lot for you help / pointing me to the right place.





More information about the keycloak-user mailing list