Пример #1
0
 public UserRepresentation getUserById(String realm, String id) {
   KeycloakSession session = server.getKeycloakSessionFactory().createSession();
   try {
     return ModelToRepresentation.toRepresentation(session.getRealmByName(realm).getUserById(id));
   } finally {
     session.close();
   }
 }
Пример #2
0
  @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;
    }
  }