aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-05-16 18:07:23 -0400
committerJim Hahn <jrh3@att.com>2018-05-16 18:12:02 -0400
commita3c172f26798c97bf822312ffcfdede738e44853 (patch)
tree9fe826483826b69927c2f37f0deafd3ef1f24119
parentbb47027e380ea5686f7c4900c8eca893518be56f (diff)
Fix authentication info in request to SO
The code was passing two different sets of credentials to the REST manager, and the wrong one was taking precedence. Modified the code to only pass the correct set of credentials. Updated license date. Change-Id: I13e2db93a8eebbb0cd77fdfaca80125cd28a2553 Issue-ID: POLICY-800 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java22
1 files changed, 2 insertions, 20 deletions
diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
index a40a2d10f..8190b1a54 100644
--- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
+++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ package org.onap.policy.so;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
-import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
@@ -153,7 +152,7 @@ public final class SOManager {
String soJson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create().toJson(request);
netLogger.info("[OUT|{}|{}|]{}{}", "SO", url, LINE_SEPARATOR, soJson);
- Pair<Integer, String> httpResponse = restManager.post(url, "policy", "policy", createAuthenticateHeaders(username, password), MEDIA_TYPE, soJson);
+ Pair<Integer, String> httpResponse = restManager.post(url, username, password, createSimpleHeaders(), MEDIA_TYPE, soJson);
// Process the response from SO
SOResponse response = waitForSOOperationCompletion(urlBase, username, password, url, httpResponse);
@@ -164,23 +163,6 @@ public final class SOManager {
return response;
}
-
- /**
- * Create HTTP headers for authenticated requests to SO.
- * @param username user name on SO
- * @param password password on SO
- * @return the HTTP headers
- */
- private Map<String, String> createAuthenticateHeaders(final String username, final String password) {
- String auth = username + ":" + password;
-
- Map<String, String> headers = new HashMap<>();
- byte[] encodedBytes = Base64.getEncoder().encode(auth.getBytes());
- headers.put("Accept", MEDIA_TYPE);
- headers.put("Authorization", "Basic " + new String(encodedBytes));
-
- return headers;
- }
}
/**