aboutsummaryrefslogtreecommitdiffstats
path: root/ncomp-sirius-manager-server/src/main
diff options
context:
space:
mode:
authorCarsten Lund <lund@research.att.com>2017-06-09 16:30:34 +0000
committerCarsten Lund <lund@research.att.com>2017-06-09 16:30:34 +0000
commitc3ed721b570f3330ea98bcf36f22c93dde8042f3 (patch)
treef715db81fbde17f7c3dff807ec7af166b8f3d380 /ncomp-sirius-manager-server/src/main
parent0ab600d544b56a5f36fe378b72b33cce506f71fe (diff)
[DCAE-15] Final update for rebased code.
Change-Id: I753b8574ee9d38a098f71ec9fe4e4f0e3a493344 Signed-off-by: Carsten Lund <lund@research.att.com>
Diffstat (limited to 'ncomp-sirius-manager-server/src/main')
-rw-r--r--ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiModelUtils.java4
-rw-r--r--ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java28
-rw-r--r--ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java17
3 files changed, 30 insertions, 19 deletions
diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiModelUtils.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiModelUtils.java
index f94c946..a36205c 100644
--- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiModelUtils.java
+++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/gui/tools/GuiModelUtils.java
@@ -514,12 +514,12 @@ public class GuiModelUtils {
for (EObject row : s.findAll(path)) {
if (ii.isRecursive()) {
for (EObject r : ManagementServer.object2containedObjects(row)) {
- if (FunctionUtils.evaluate(r, ii.getFilter()).toLowerCase().equals("true"))
+ if (FunctionUtils.evaluate(r, ii.getFilter()).equalsIgnoreCase("true"))
tableAddRow(s,r,table,t);
}
}
else {
- if (FunctionUtils.evaluate(row, ii.getFilter()).toLowerCase().equals("true"))
+ if (FunctionUtils.evaluate(row, ii.getFilter()).equalsIgnoreCase("true"))
tableAddRow(s,row,table,t);
}
}
diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java
index 59dfeb3..b97053c 100644
--- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java
+++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/JavaHttpClient.java
@@ -35,6 +35,7 @@ import org.openecomp.ncomp.sirius.manager.logging.ManagementServerOperationEnum;
import org.openecomp.ncomp.sirius.manager.logging.NcompLogger;
import org.openecomp.ncomp.utils.CryptoUtils;
import org.openecomp.ncomp.utils.PropertyUtil;
+import org.openecomp.ncomp.utils.SecurityUtils;
import org.openecomp.ncomp.webservice.utils.FileUtils;
public class JavaHttpClient extends AbstractClient {
@@ -49,7 +50,7 @@ public class JavaHttpClient extends AbstractClient {
props = PropertyUtil.getPropertiesFromClasspath(fileName);
setBaseAddress(props.getProperty(endpoint + ".endpoint"));
if (getBaseAddress() == null) {
- logger.error("unable to determine baseAddress for endpoint: " + endpoint + " in " + fileName);
+ logger.error("unable to determine baseAddress for endpoint: " + p(endpoint) + " in " + p(fileName));
throw new RuntimeException("unable to determine baseAddress for endpoint: " + endpoint + " in "
+ fileName);
}
@@ -66,6 +67,10 @@ public class JavaHttpClient extends AbstractClient {
}
}
+ private String p(String v) {
+ return SecurityUtils.logForcingProtection(v);
+ }
+
public static String decryptPassword(String s) {
if (s == null) return s;
if (s.startsWith("rsa:")) {
@@ -75,16 +80,17 @@ public class JavaHttpClient extends AbstractClient {
}
public static String decryptEmbeddedPassword(String s) {
- if (s == null) return s;
- int i1 = s.indexOf("rsa:::");
- int i2 = s.indexOf("rsa:::rsa:");
- int i3 = s.indexOf(":::rsa");
- int i4 = i1 + 6;
- if (i2 < i1) {
- i1 = i2;
- i4 = i1 + 10;
- }
- if (i1 == -1) return s;
+ if (s == null) return s;
+ int i1 = s.indexOf("rsa:::");
+ int i2 = s.indexOf("rsa:::rsa:");
+ int i4 = i1 + 6;
+ if (i2 != -1 && i2 == i1) {
+ i1 = i2;
+ i4 = i1 + 10;
+ }
+ if (i1 == -1) return s;
+ int i3 = s.indexOf(":::rsa",i4);
+
String pw = CryptoUtils.decryptPrivate(CryptoUtils.getKey("config/server.private"), s.substring(i4,i3));
if (s.startsWith("rsa:")) {
diff --git a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java
index a2aa2d9..98421d3 100644
--- a/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java
+++ b/ncomp-sirius-manager-server/src/main/java/org/openecomp/ncomp/sirius/manager/ManagementServer.java
@@ -91,6 +91,7 @@ import org.openecomp.ncomp.sirius.manager.server.ServerFactory;
import org.openecomp.ncomp.sirius.manager.server.ServerPackage;
import org.openecomp.ncomp.sirius.manager.server.VersionConfiguration;
import org.openecomp.ncomp.utils.PropertyUtil;
+import org.openecomp.ncomp.utils.SecurityUtils;
import org.openecomp.ncomp.utils.SortUtil;
import org.openecomp.ncomp.webservice.utils.FileUtils;
import org.openecomp.ncomp.webservice.utils.JsonUtils;
@@ -192,7 +193,7 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge
r.put("path", resourcePath);
r.put("req", json);
r.put("context", context);
- logger2.info(r.toString());
+ logger2.info(p(r.toString()));
}
if (!pe.permit(userName, action, resourcePath)) {
handleJsonReportResult(reqId, start, null, "NOT_PERMITTED", logger2, clientVersion);
@@ -294,6 +295,10 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge
return res;
}
+ private String p(Object s) {
+ return SecurityUtils.logForcingProtection(s);
+ }
+
private void transformResult(Subject subject, String action, Object res) {
String a = (subject != null && subject.o != null) ? ( subject.o.eClass().getInstanceClassName() + "@" + action ) : action;
// System.out.println("KKKKKKK:" + subject + " " + action + " " + a);
@@ -543,8 +548,8 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge
}
EClass c = (EClass) f.getEPackage().getEClassifier(cName);
if (c == null) {
- logger.error("unable to create class: " + cName + " using factory " + f.getEPackage().getName() + " "
- + json.toString(2));
+ logger.error("unable to create class: " + p(cName) + " using factory " + f.getEPackage().getName() + " "
+ + p(json.toString(2)));
throw new RuntimeException("Unable to create class " + cName + " using factory "
+ f.getEPackage().getName());
}
@@ -713,7 +718,7 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge
}
if (k.equals("$nosave"))
continue;
- logger.warn("JSON value not used: " + k + " " + f.getEPackage().getName() + "." + cName + " " + json.get(k));
+ logger.warn("JSON value not used: " + p(k) + " " + f.getEPackage().getName() + "." + p(cName) + " " + p(json.get(k)));
}
return o;
}
@@ -1778,7 +1783,7 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge
continue;
}
if (!json.has(p.getName())) {
- logger.warn("Operation " + PropertyUtil.replaceForLogForcingProtection(action) + " has missing parameter:" + p.getName());
+ logger.warn("Operation " + p(action) + " has missing parameter:" + p.getName());
}
Object oo = null;
if (p.isMany()) {
@@ -2246,7 +2251,7 @@ public class ManagementServer implements IRequestHandler, ISiriusServer, ISwagge
}
Subject s = find(root1, path);
if (s == null || s.ref != null) {
- logger.warn("Unable to determine reference for:" + PropertyUtil.replaceForLogForcingProtection(path));
+ logger.warn("Unable to determine reference for:" + p(path));
continue;
}
if (x.ref.isMany()) {