aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-07-22 11:21:05 +0300
committerIttay Stern <ittay.stern@att.com>2019-07-22 11:36:00 +0300
commit673b18baae5db233d3da2a2b40f9b5d772c6cee2 (patch)
tree92e9f6d933d1c7217864c50bed8145621e9cd538 /vid-app-common/src/main/java
parent7777af2d57f3461b06f8c787cfb6e33c3b01e8a6 (diff)
Allow full-path to certificate and remove implicit Optional::toString
1) If getAAITruststoreFilename or getAAIKeystoreFilename has a file separator -- don't append certFilePath to filename. 2) getKeystorePath() is issuing Optional::orElse, as the code `+ getAAIKeystoreFilename()` is implicitly calling `getAAIKeystoreFilename().toString()` which yields a default toString e.g. "Optional[configValue]". Issue-ID: VID-229 Change-Id: I9c135cc3dfd72cdc203b59d78162a568a6dbd688 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java
index e2a6d0e04..af181eb1f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java
@@ -116,13 +116,13 @@ public class HttpsAuthClient {
return new NoopHostnameVerifier();
}
- private String getKeystorePath() {
- return getCertificatesPath() + FileSystems.getDefault().getSeparator() + systemPropertyHelper.getAAIKeystoreFilename();
+ protected String getKeystorePath() {
+ return systemPropertyHelper.getAAIKeystoreFilename().map(this::getCertificatesPathOf).orElse("");
}
private void setSystemProperties() {
- System.setProperty(SSL_TRUST_STORE, getCertificatesPath() + FileSystems.getDefault().getSeparator() +
- systemPropertyHelper.getAAITruststoreFilename().orElse(""));
+ System.setProperty(SSL_TRUST_STORE,
+ systemPropertyHelper.getAAITruststoreFilename().map(this::getCertificatesPathOf).orElse(""));
System.setProperty(SSL_TRUST_STORE_PASS_WORD, systemPropertyHelper.getDecryptedTruststorePassword());
}
@@ -135,8 +135,11 @@ public class HttpsAuthClient {
return config;
}
- private String getCertificatesPath() {
- return certFilePath;
+ private String getCertificatesPathOf(String fileName) {
+ if (fileName.contains("/") || fileName.contains("\\")) {
+ return fileName;
+ }
+ return certFilePath + FileSystems.getDefault().getSeparator() + fileName;
}
}