We have something working here, we're about to start using it, although it still isn't finished,
I had some conversations with my superior, and he asked me to do some alterations, and as soon as we have it tested better, I'll request him to make the github repo public. I would really like to be able to contribute to Keycloak with this, so please let me know of any alterations you see fit as soon as you can see the code.
But just so you can have a better feel (and maybe suggest something), this is an example of usage:
Keycloak keycloak = Keycloak.getInstance(SERVER_URL, REALM, USERNAME, PASSWORD, CLIENT_ID, CLIENT_SECRET);
// Create a new user
UserRepresentation stian = new UserRepresentation();
stian.setUsername("stian");
keycloak.userService().create(stian);
// Grant roles to user
keycloak.userService().grantRoles("stian", roles);
// Find all users
List<UserRepresentation> users = keycloak.userService().findAll();
My superior thought it was confusing to extend the representation, because some methods would only alter the values in the class, while others would actually access the REST API, so he suggested that we do it like the examples above.
Any thoughts?