use of net.geoprism.account.OauthServer in project geoprism-registry by terraframe.
the class RegistryService method oauthGetAll.
@Request(RequestType.SESSION)
public String oauthGetAll(String sessionId, String id) {
final JsonArray ja = new JsonArray();
if (id == null || id.length() == 0) {
OauthServer[] servers = OauthServer.getAll();
for (OauthServer server : servers) {
Gson gson2 = new GsonBuilder().registerTypeAdapter(OauthServer.class, new RunwayJsonAdapters.RunwayDeserializer()).create();
JsonObject json = (JsonObject) gson2.toJsonTree(server);
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
} else {
OauthServer server = OauthServer.get(id);
Gson gson2 = new GsonBuilder().registerTypeAdapter(OauthServer.class, new RunwayJsonAdapters.RunwayDeserializer()).create();
JsonObject json = (JsonObject) gson2.toJsonTree(server);
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
return ja.toString();
}
use of net.geoprism.account.OauthServer in project geoprism-registry by terraframe.
the class RegistryService method oauthGetPublic.
@Request(RequestType.SESSION)
public String oauthGetPublic(String sessionId, String id) {
final JsonArray ja = new JsonArray();
if (id == null || id.length() == 0) {
OauthServer[] servers = OauthServer.getAll();
for (OauthServer server : servers) {
if (!FhirExternalSystem.isFhirOauth(server)) {
JsonObject json = new JsonObject();
json.add("label", LocalizedValueConverter.convert(server.getDisplayLabel()).toJSON());
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
}
} else {
OauthServer server = OauthServer.get(id);
JsonObject json = new JsonObject();
json.add("label", LocalizedValueConverter.convert(server.getDisplayLabel()).toJSON());
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
return ja.toString();
}
use of net.geoprism.account.OauthServer in project geoprism-registry by terraframe.
the class JsonSerializationTest method getOauthServer.
@Request
private OauthServer getOauthServer() {
OauthServer oauth = new OauthServer();
oauth.setSecretKey("1e6db50c-0fee-11e5-98d0-3c15c2c6caf6");
oauth.setClientId("geoprism");
oauth.setProfileLocation("http://test-profile.example.net/profile");
oauth.setAuthorizationLocation("http://test-profile.example.net/authorization");
oauth.setTokenLocation("http://test-profile.example.net/token");
oauth.setServerType("DHIS2");
oauth.apply();
return oauth;
}
Aggregations