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

Patrick Andreas Näf p.naef at naef-itcom.ch
Fri Sep 11 08:46:45 EDT 2015


Hi everybody

Sorry very much... I was too stupid!!!
GET /admin/realms/{realm}/users/{id}/role-mappings 
<cid:part1.09090803.09070605 at naef-itcom.ch>

I set {id} as user NAME, not user ID. Now it's clear.

Sorry again to pollute the mailing list with such stupid questions, but 
maybe someone will find it with google and then he won't make this 
stupid error!



Am 11.09.2015 um 13:17 schrieb Patrick Andreas Näf:
> 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.
>
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>

-- 
Näf ITCom AG
Patrick Andreas Näf
CEO / Owner
MSc ETH Inf.-Ing.
Höhenweg 7
4917 Melchnau

web: www.naef-itcom.ch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20150911/afb93067/attachment.html 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20150911/afb93067/attachment-0001.html 


More information about the keycloak-user mailing list