summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorMohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>2018-09-13 15:18:57 -0400
committerPrudence Au <prudence.au@amdocs.com>2018-09-14 13:34:53 -0400
commitb78e5c4271023b4879f5fa056266b987289fed2d (patch)
tree5dead5c7f7995195af1f49a88be6c28361b78d71 /src/main
parent37901c75f865ce54a1a25686cd0287db22958e7e (diff)
Added support for obfuscated password
Issue-ID: LOG-439 Change-Id: Ib313b0a18b1da646b484a8beb3f4074b4e58044a Signed-off-by: Mohammadreza Pasandideh <mohammadreza.pasandideh@amdocs.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java b/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java
index 0b2d3cb..3881642 100644
--- a/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java
+++ b/src/main/java/org/onap/pomba/contextaggregator/rest/RestRequest.java
@@ -23,6 +23,7 @@ import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
+import org.eclipse.jetty.util.security.Password;
import org.onap.aai.restclient.client.Headers;
import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.restclient.client.RestClient;
@@ -42,6 +43,8 @@ public class RestRequest {
private static final String APP_NAME = "context-aggregator";
+ private static final String BASIC_AUTH = "Basic ";
+
private static Logger log = LoggerFactory.getLogger(RestRequest.class);
@@ -88,11 +91,6 @@ public class RestRequest {
private static RestClient createRestClient(ContextBuilder builder) {
return new RestClient()
- // .validateServerHostname(false)
- // .validateServerCertChain(true)
- // .clientCertFile(builder.getKeyStorePath())
- // .clientCertPassword(builder.getKeyStorePassword())
- // .trustStore(builder.getTrustStorePath())
.connectTimeoutMs(builder.getConnectionTimeout()).readTimeoutMs(builder.getReadTimeout());
}
@@ -114,9 +112,9 @@ public class RestRequest {
}
private static String getBasicAuthString(ContextBuilder builder) {
- String usernamePasswordString = builder.getUsername() + ":" + builder.getPassword();
- String encodedString = Base64.getEncoder().encodeToString((usernamePasswordString).getBytes());
- return "Basic " + encodedString;
+ String encodedString = Base64.getEncoder().encodeToString(( builder.getUsername() + ":" +
+ Password.deobfuscate(builder.getPassword())).getBytes());
+ return BASIC_AUTH + encodedString;
}
}