X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=properties-node%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fccsdk%2Fsli%2Fplugins%2Fprop%2FPropertiesNode.java;h=b4bc84747b3ea11ea2b63b37738bb5af6b4dac79;hb=57bfbb05e485fb11b620b1bf12e70aa063aaa3c8;hp=f0c7e0b453ad64efcf542c4e99626a4bd20f5937;hpb=b43008aa2dce75efdf704d1a5e2529e58b4fbde1;p=ccsdk%2Fsli%2Fplugins.git diff --git a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java index f0c7e0b4..b4bc8474 100644 --- a/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java +++ b/properties-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/prop/PropertiesNode.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,14 +63,14 @@ public class PropertiesNode implements SvcLogicJavaPlugin { String name = (String) key; String value = prop.getProperty(name); if (value != null && value.trim().length() > 0) { - ctx.setAttribute(pfx + name, value.trim()); + ctx.setAttribute(pfx + name, getObfuscatedVal(value.trim())); log.info("+++ " + pfx + name + ": [" + maskPassword(pfx + name, value) + "]"); } } } if (mm != null) { for (Map.Entry entry : mm.entrySet()) { - ctx.setAttribute(pfx + entry.getKey(), entry.getValue()); + ctx.setAttribute(pfx + entry.getKey(), getObfuscatedVal(entry.getValue())); log.info("+++ " + pfx + entry.getKey() + ": [" + maskPassword(pfx + entry.getKey(), entry.getValue()) + "]"); } @@ -81,7 +81,7 @@ public class PropertiesNode implements SvcLogicJavaPlugin { String name = (String) key; String value = prop.getProperty(name); if (value != null && value.trim().length() > 0) { - ctx.setAttribute(pfx + name, value.trim()); + ctx.setAttribute(pfx + name, getObfuscatedVal(value.trim())); log.info("+++ " + pfx + name + ": [" + maskPassword(pfx + name, value) + "]"); } } @@ -92,6 +92,25 @@ public class PropertiesNode implements SvcLogicJavaPlugin { } } + /* Unobfuscate param value */ + private static String getObfuscatedVal(String paramValue) { + String resValue = paramValue; + if (paramValue != null && paramValue.startsWith("${") && paramValue.endsWith("}")) + { + String paramStr = paramValue.substring(2, paramValue.length()-1); + if (paramStr != null && paramStr.length() > 0) + { + String val = System.getenv(paramStr); + if (val != null && val.length() > 0) + { + resValue=val; + log.info("Obfuscated value RESET for param value:" + paramValue); + } + } + } + return resValue; + } + /* * Getting extension has to do the following "" --> "" "name" --> "" "name.txt" --> "txt" * ".htpasswd" --> "" "name.with.many.dots.myext" --> "myext"