From 9cedbd41c0ee3bade89de5d2e1e822cc4e9a36e7 Mon Sep 17 00:00:00 2001 From: ramverma Date: Fri, 5 Oct 2018 15:36:11 +0100 Subject: Fix sonar bugs in apex-pdp Change-Id: I1ab9b9d9b0b8d1655301959d7d6b9ab3cc87eba3 Issue-ID: POLICY-954 Signed-off-by: ramverma --- .../event/carrier/jms/JmsCarrierTechnologyParameters.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins/plugins-event') diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java index d4cb2ab9a..1b2b44382 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/src/main/java/org/onap/policy/apex/plugins/event/carrier/jms/JmsCarrierTechnologyParameters.java @@ -20,6 +20,7 @@ package org.onap.policy.apex.plugins.event.carrier.jms; +import java.util.Base64; import java.util.Properties; import javax.naming.Context; @@ -86,7 +87,7 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters private static final String DEFAULT_INITIAL_CTXT_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory"; private static final String DEFAULT_PROVIDER_URL = "remote://localhost:4447"; private static final String DEFAULT_SECURITY_PRINCIPAL = "userid"; - private static final String DEFAULT_SECURITY_CREDENTIALS = "password"; + private static final String DEFAULT_SECURITY_CREDENTIALS = "cGFzc3dvcmQ="; private static final String DEFAULT_CONSUMER_TOPIC = "apex-in"; private static final String DEFAULT_PRODUCER_TOPIC = "apex-out"; private static final int DEFAULT_CONSUMER_WAIT_TIME = 100; @@ -103,7 +104,7 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters private String initialContextFactory = DEFAULT_INITIAL_CTXT_FACTORY; private String providerUrl = DEFAULT_PROVIDER_URL; private String securityPrincipal = DEFAULT_SECURITY_PRINCIPAL; - private String securityCredentials = DEFAULT_SECURITY_CREDENTIALS; + private String securityCredentials = getDefaultCredential(); private String producerTopic = DEFAULT_PRODUCER_TOPIC; private String consumerTopic = DEFAULT_CONSUMER_TOPIC; private int consumerWaitTime = DEFAULT_CONSUMER_WAIT_TIME; @@ -382,4 +383,8 @@ public class JmsCarrierTechnologyParameters extends CarrierTechnologyParameters private boolean isNullOrBlank(final String stringValue) { return stringValue == null || stringValue.trim().length() == 0; } + + private String getDefaultCredential() { + return new String(Base64.getDecoder().decode(DEFAULT_SECURITY_CREDENTIALS.getBytes())); + } } -- cgit 1.2.3-korg