Thank you for the response :)
I had the same idea and so I grab the existing realm roles from the
server before I create the new group. A realm role with the desired name
exists and I try to add it with ID and name in setRealmRoles.
I also try to add a group at first, grab the group list from server and
update the group with new (but existing) realm roles. With wireshark I
sniff the content that goes to the rest service and it contains my data.
The response was HTTP-State 202 (no data).
I test my code against final version 1.9.4 and 1.9.5. The keycloak
server runs in standalone mode in a Ubuntu 14.04 VM and uses Postgresql
as backend.
Beside the groups I got a similar effect if I create a new user. I can
create the user, but he has no assigned group.
Cheers
Am 31.05.2016 um 13:03 schrieb Stan Silvert:
I suspect your problem is that the roles don't exist yet. You
need to
create the role as a realm role before you assign it to a group.
realmResource.roles().create(myRole);
On 5/31/2016 6:30 AM, Okie Oth wrote:
> Hello,
> I'm a keycloak newbie and try to write a tool that initialize my
> keycloak installation. Some parts work fine but I can't do deeper
> initializations. For instance I can create a new user group but if I
> want to assign some realm roles for the new created group nothing
> happens.
>
> I checked the results with the normal Keycloak webfrontend.
>
> Here is my sample code:
> ...
> GroupRepresentation gr = new GroupRepresentation();
> gr.setName("myGroup");
> List<String> realmRoleList=new ArrayList();
> realmRoleList.add("test");
> gr.setRealmRoles(realmRoleList);
> realmResource.groups().add(gr);
> ...
> // now the group 'myGroup' exists but no roles are assigned.
>
> Any advice or help is welcome
>
> Kind regards
> Eiko
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/keycloak-user