aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork.kazak <k.kazak@samsung.com>2019-04-12 17:19:55 +0200
committerk.kazak <k.kazak@samsung.com>2019-04-12 17:19:55 +0200
commit32dee8717b9f44659e0f10d7b6d50c90feb18155 (patch)
tree090101e78dcf2bfd7845235ae85342c104ecaa6c
parent48478b9531fb2901c392ce1142f9443b5d805148 (diff)
Remove hardcoded literals
Remove unused hardcoded literals Fix sonar issues with potential hardcoded password literal Change-Id: I4e2cf1f731e8cc2ee9914480d6422e00db276d65 Issue-ID: SO-1788 Signed-off-by: k.kazak <k.kazak@samsung.com>
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java18
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java14
2 files changed, 8 insertions, 24 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
index 7d92c637ad..e2c358aa53 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
@@ -47,24 +47,6 @@ public class ASDCConfiguration implements IConfiguration {
private String asdcControllerName;
- public static final String MSO_PROP_ASDC = "MSO_PROP_ASDC";
- public static final String PARAMETER_PATTERN = "asdc-connections";
- public static final String MSG_BUS_ADDRESS_ATTRIBUTE_NAME = "messageBusAddress";
- public static final String WATCHDOG_TIMEOUT_NAME = "watchDogTimeout";
-
- public static final String CONSUMER_GROUP_ATTRIBUTE_NAME = "consumerGroup";
- public static final String CONSUMER_ID_ATTRIBUTE_NAME = "consumerId";
- public static final String ENVIRONMENT_NAME_ATTRIBUTE_NAME = "environmentName";
- public static final String PASSWORD_ATTRIBUTE_NAME = "password";
- public static final String POLLING_INTERVAL_ATTRIBUTE_NAME = "pollingInterval";
- public static final String RELEVANT_ARTIFACT_TYPES_ATTRIBUTE_NAME = "relevantArtifactTypes";
- public static final String USER_ATTRIBUTE_NAME = "user";
- public static final String ASDC_ADDRESS_ATTRIBUTE_NAME = "asdcAddress";
- public static final String POLLING_TIMEOUT_ATTRIBUTE_NAME = "pollingTimeout";
- public static final String ACTIVATE_SERVER_TLS_AUTH = "activateServerTLSAuth";
- public static final String KEY_STORE_PASSWORD = "keyStorePassword";
- public static final String KEY_STORE_PATH = "keyStorePath";
-
public static final String HEAT = "HEAT";
public static final String HEAT_ARTIFACT = "HEAT_ARTIFACT";
public static final String HEAT_ENV = "HEAT_ENV";
diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index abef417325..f5737b862c 100644
--- a/common/src/main/java/org/onap/so/client/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java
@@ -33,9 +33,8 @@ import javax.ws.rs.client.ClientBuilder;
public abstract class RestClientSSL extends RestClient {
private static final String TRUE = "true";
- public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
- public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword";
- public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
+ private static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
+ private static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
protected RestClientSSL(RestProperties props, Optional<URI> path) {
@@ -55,8 +54,7 @@ public abstract class RestClientSSL extends RestClient {
if (loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase(TRUE)) {
KeyStore ks = getKeyStore();
if (ks != null) {
- client = ClientBuilder.newBuilder()
- .keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build();
+ client = ClientBuilder.newBuilder().keyStore(ks, getSSlKeyStorePassword()).build();
logger.info("RestClientSSL not using default SSL context - setting keystore here.");
return client;
}
@@ -72,7 +70,7 @@ public abstract class RestClientSSL extends RestClient {
private KeyStore getKeyStore() {
KeyStore ks = null;
- char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray();
+ char[] password = getSSlKeyStorePassword().toCharArray();
try (FileInputStream fis = new FileInputStream(
Paths.get(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY)).normalize().toString())) {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -84,4 +82,8 @@ public abstract class RestClientSSL extends RestClient {
return ks;
}
+
+ private String getSSlKeyStorePassword() {
+ return System.getProperty("javax.net.ssl.keyStorePassword");
+ }
}