public UserRepresentation getUserById(String realm, String id) { KeycloakSession session = server.getKeycloakSessionFactory().createSession(); try { return ModelToRepresentation.toRepresentation(session.getRealmByName(realm).getUserById(id)); } finally { session.close(); } }
@GET @NoCache @Produces("application/json") public RealmRepresentation getRealm() { if (auth.hasView()) { return ModelToRepresentation.toRepresentation(realm); } else { auth.requireAny(); RealmRepresentation rep = new RealmRepresentation(); rep.setRealm(realm.getName()); return rep; } }