summaryrefslogtreecommitdiffstats
path: root/jar/src/main/java/org/onap/music/main/MusicUtil.java
diff options
context:
space:
mode:
authorThomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>2018-10-08 14:29:46 -0400
committerThomas Nelson <nelson24@att.com>2018-10-10 18:01:36 +0000
commita3cd1553531d81ca88b4d2f426fe527dd1e909a8 (patch)
tree73d45c5cac9d44fcf10e92e9b1914d14d90260b3 /jar/src/main/java/org/onap/music/main/MusicUtil.java
parent902fe25132d9651cc1a6af9229678572b68c7c2c (diff)
Update to support Encrypted password
in properties. Update duplicate entries in pom file. Add dependency Fix Version Change-Id: If427601841c14cb14232452b4ec8236e76075275 Issue-ID: MUSIC-146 Signed-off-by: Thomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>
Diffstat (limited to 'jar/src/main/java/org/onap/music/main/MusicUtil.java')
-rwxr-xr-xjar/src/main/java/org/onap/music/main/MusicUtil.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/jar/src/main/java/org/onap/music/main/MusicUtil.java b/jar/src/main/java/org/onap/music/main/MusicUtil.java
index f18570db..77afb57e 100755
--- a/jar/src/main/java/org/onap/music/main/MusicUtil.java
+++ b/jar/src/main/java/org/onap/music/main/MusicUtil.java
@@ -531,14 +531,15 @@ public class MusicUtil {
public static void loadProperties() throws Exception {
- Properties prop = new Properties();
+ CipherUtil.readAndSetKeyString();
+ Properties prop = new Properties();
InputStream input = null;
try {
- // load the properties file
+ // load the properties file
input = MusicUtil.class.getClassLoader().getResourceAsStream("music.properties");
prop.load(input);
} catch (Exception ex) {
- logger.error(EELFLoggerDelegate.errorLogger, "Unable to find properties file.");
+ logger.error(EELFLoggerDelegate.errorLogger, "Unable to find properties file.");
throw new Exception();
} finally {
if (input != null) {
@@ -549,12 +550,23 @@ public class MusicUtil {
}
}
}
+ String cassPwd = prop.getProperty("cassandra.password");
+ String isEncrypted = prop.getProperty("cassandra.password.isencrypted");
+ logger.info(EELFLoggerDelegate.applicationLogger,"cassandra.password:" + cassPwd);
+ logger.info(EELFLoggerDelegate.applicationLogger,"cassandra.password.isencrypted:" + isEncrypted);
+ if("true".equals(isEncrypted)) {
+ logger.info(EELFLoggerDelegate.applicationLogger,"Decrypting....");
+ cassPwd = CipherUtil.decryptPKC(cassPwd);
+ logger.info(EELFLoggerDelegate.applicationLogger,"Decrypted password: "+cassPwd);
+ MusicUtil.setCassPwd(cassPwd);
+ } else
+ MusicUtil.setCassPwd(cassPwd);
// get the property value and return it
- MusicUtil.setMyCassaHost(prop.getProperty("cassandra.host"));
- String zkHosts = prop.getProperty("zookeeper.host");
- MusicUtil.setMyZkHost(zkHosts);
- MusicUtil.setCassName(prop.getProperty("cassandra.user"));
- MusicUtil.setCassPwd(prop.getProperty("cassandra.password"));
+ MusicUtil.setMyCassaHost(prop.getProperty("cassandra.host"));
+ String zkHosts = prop.getProperty("zookeeper.host");
+ MusicUtil.setMyZkHost(zkHosts);
+ MusicUtil.setCassName(prop.getProperty("cassandra.user"));
}
+
}