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

Stian Thorgersen stian at redhat.com
Fri Sep 11 10:21:14 EDT 2015



----- Original Message -----
> From: "Patrick Andreas Näf" <p.naef at naef-itcom.ch>
> To: keycloak-user at lists.jboss.org
> Sent: Friday, 11 September, 2015 2:46:45 PM
> Subject: Re: [keycloak-user] Can't get roles of user via REST
> 
> Hi everybody
> 
> Sorry very much... I was too stupid!!!
> GET /admin/realms/{realm}/users/{id}/role-mappings
> 
> 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!

There's no stupid questions - pleased you figured it out though :)

> 
> 
> 
> 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
> 
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user


More information about the keycloak-user mailing list