From a07b57086dd5c9c04f2b20a092da9935c7c5f817 Mon Sep 17 00:00:00 2001 From: "Smokowski, Kevin (ks6305)" Date: Fri, 22 Jun 2018 18:32:27 +0000 Subject: check for null usernamd and password only populate auth header if credentials are provided, this support was requested by a client Change-Id: I2fb60995260506a29482d340a031dfad72348b8c Issue-ID: CCSDK-310 Signed-off-by: Smokowski, Kevin (ks6305) --- .../sli/northbound/dmaapclient/MessageRouterHttpClient.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'dmaap-listener') diff --git a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java index 234a2026b..d261d1c49 100644 --- a/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java +++ b/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java @@ -135,11 +135,14 @@ public class MessageRouterHttpClient implements SdncDmaapConsumer { Integer readTimeoutMinutes = Integer.valueOf(baseProperties.getProperty("readTimeoutMinutes", DEFAULT_READ_TIMEOUT_MINUTES)); - String authorizationString = buildAuthorizationString(username, password); + Builder builder = client.target(uri).request("application/json"); + if (username != null && password != null && username.length() > 0 && password.length() > 0) { + String authorizationString = buildAuthorizationString(username, password); + builder.header("Authorization", authorizationString); + } this.uri = buildUri(topic, group, id, host, timeoutQueryParamValue, limit, filter); this.client = getClient(connectTimeoutSeconds, readTimeoutMinutes); - Builder builder = - client.target(uri).request("application/json").header("Authorization", authorizationString); + this.getMessages = builder.buildGet(); this.fetchPause = Integer.valueOf(baseProperties.getProperty("fetchPause")); this.isReady = true; -- cgit 1.2.3-korg