Hi,
I am trying to create admin user for a specific realm programmatically, I am able to create the user, however I can't assign the realm client roles to it.
For example in the UI I would go to the user 'Role Mappings' choose the realm client role and move the required roles from the Available section to the Assigned.
When I try to it programmatically I am getting 404, my code is below, note that I am getting 404 on the last line -
adminUserClientRole.listAvailable())
createUserAndPsw(keyCloakClient,
"master", user);
RealmResource realm = keyCloakClient.realm("master");
UserResource userResource = realm.users().get(user.getKeyCloakId());
RoleMappingResource roles = userResource.roles();
RoleScopeResource adminUserClientRole = roles.clientLevel(tenantId + "-realm");
adminUserClientRole.add(adminUserClientRole.listAvailable());
Any advice will be appreciated.
Thanks,
Haim.