@GET
  @Path("audit")
  @Produces("application/json")
  public RealmAuditRepresentation getRealmAudit() {
    auth.init(RealmAuth.Resource.AUDIT).requireView();

    return ModelToRepresentation.toAuditReprensetation(realm);
  }
 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;
    }
  }