supporting clear text and obfuscated client cert 87/75587/1
authorBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
Wed, 9 Jan 2019 19:47:39 +0000 (14:47 -0500)
committerBansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
Wed, 9 Jan 2019 19:50:41 +0000 (14:50 -0500)
supporting clear text and obfuscated client cert

Change-Id: I2e5332839993283446904ca6065d7ead8b29cb0f
Issue-ID: AAI-2046
Signed-off-by: Bansal, Nitin (nb121v) <nitin.bansal@amdocs.com>
src/main/java/org/onap/aai/rest/RestClientProducer.java

index 24c8eee..4170525 100644 (file)
@@ -241,10 +241,12 @@ public class RestClientProducer extends DefaultProducer {
             + " keystore=" + keystoreFilename + " keystorePassword=" + keystorePassword);
       }
 
+      String deobfuscatedCertPassword = keystorePassword.startsWith("OBF:")?Password.deobfuscate(keystorePassword):keystorePassword;
+      
       // Create REST client for search service
       restClient = new RestClient().validateServerHostname(false).validateServerCertChain(true)
           .clientCertFile(clientCertFilename)
-          .clientCertPassword(Password.deobfuscate(keystorePassword)).trustStore(keystoreFilename);
+          .clientCertPassword(deobfuscatedCertPassword).trustStore(keystoreFilename);
     }
 
     return restClient;