support clear text/jetty obfuscated password 16/73816/1
authorBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
Wed, 28 Nov 2018 20:02:51 +0000 (15:02 -0500)
committerBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
Wed, 28 Nov 2018 20:03:49 +0000 (15:03 -0500)
support clear text/jetty obfuscated password for talking to secure Elastic search

Change-Id: I864320f3884da1171b7c7980edbe8858197afc97
Issue-ID: AAI-1971
Signed-off-by: Bansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/config/ElasticSearchConfig.java
src/main/java/org/onap/aai/sa/searchdbabstraction/elasticsearch/dao/ElasticSearchHttpController.java

index f5cb9da..0d116f8 100644 (file)
@@ -189,7 +189,11 @@ public class ElasticSearchConfig {
 
         Optional<String> passwordValue = Optional.ofNullable(props.getProperty(ES_TRUST_STORE_ENC));
         if (passwordValue.isPresent()) {
+          if(passwordValue.get().startsWith("OBF:")){
             setTrustStorePassword(Password.deobfuscate(passwordValue.get()));
+          }else{
+            setTrustStorePassword(passwordValue.get());
+          }
         }
 
         Optional<String> keyStoreFile = Optional.ofNullable(props.getProperty(ES_KEY_STORE));
@@ -199,7 +203,11 @@ public class ElasticSearchConfig {
 
         passwordValue = Optional.ofNullable(props.getProperty(ES_KEY_STORE_ENC));
         if (passwordValue.isPresent()) {
+          if(passwordValue.get().startsWith("OBF:")){
             setKeyStorePassword(Password.deobfuscate(passwordValue.get()));
+          }else{
+            setKeyStorePassword(passwordValue.get());
+          }
         }
     }
 
index 716814b..759c997 100644 (file)
@@ -1397,7 +1397,8 @@ public class ElasticSearchHttpController implements DocumentStoreInterface {
         metricsLogger.info(message,
                 new LogFields() //
                         .setField(LogLine.DefinedFields.RESPONSE_CODE, operationResult.getResultCode())
-                        .setField(LogLine.DefinedFields.RESPONSE_DESCRIPTION, operationResult.getResult()),
+                        .setField(LogLine.DefinedFields.RESPONSE_DESCRIPTION, operationResult.getResult())
+                        .setField(LogLine.DefinedFields.SERVER_IP, "ElasticHost-"+config.getIpAddress()),
                 override, args);
     }
 }