diff options
author | Smokowski, Kevin (ks6305) <ks6305@att.com> | 2018-06-22 18:32:27 +0000 |
---|---|---|
committer | Smokowski, Kevin (ks6305) <ks6305@att.com> | 2018-06-22 18:33:23 +0000 |
commit | a07b57086dd5c9c04f2b20a092da9935c7c5f817 (patch) | |
tree | 13c3bfe49864f9eb1a5f8d5a79a476adff3aa812 | |
parent | a63bbe21b7394951d782b6f8f0769dfcbc616dd0 (diff) |
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) <ks6305@att.com>
-rw-r--r-- | dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java | 9 |
1 files changed, 6 insertions, 3 deletions
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; |