use of com.tremolosecurity.config.xml.ApplicationType in project OpenUnison by TremoloSecurity.
the class LoadApplicationsFromK8s method modifyObject.
@Override
public void modifyObject(TremoloType cfg, JSONObject item) throws ProvisioningException {
String rawJson = item.toJSONString();
StringBuffer b = new StringBuffer();
b.setLength(0);
OpenUnisonConfigLoader.integrateIncludes(b, rawJson);
try {
JSONObject newRoot = (JSONObject) new JSONParser().parse(b.toString());
JSONObject metadata = (JSONObject) newRoot.get("metadata");
if (metadata == null) {
throw new ProvisioningException("No metadata");
}
String name = (String) metadata.get("name");
logger.info("Modifying application " + name);
try {
synchronized (GlobalEntries.getGlobalEntries().getConfigManager()) {
ApplicationType app = this.createApplication(item, name);
GlobalEntries.getGlobalEntries().getConfigManager().deleteApp(app.getName());
GlobalEntries.getGlobalEntries().getConfigManager().initializeUrls(GlobalEntries.getGlobalEntries().getConfigManager().addApplication(app));
}
} catch (Exception e) {
logger.warn("Could not modify application " + name, e);
}
} catch (ParseException e) {
throw new ProvisioningException("Could not parse custom authorization", e);
}
}
Aggregations