summaryrefslogtreecommitdiffstats
path: root/examples/VotingApp
diff options
context:
space:
mode:
authorTschaen, Brendan <ctschaen@att.com>2019-03-07 16:02:44 -0500
committerTschaen, Brendan <ctschaen@att.com>2019-03-07 16:02:44 -0500
commite4e227b18dcd4a4dd40bc3e3a8373f3d96c6511d (patch)
treec7399da1f7e9ed9d4c672fa61063afea9fcb3507 /examples/VotingApp
parent4d6e2a982cc0ee48aca9d8531424d795e44842c9 (diff)
Update voting app with basic auth
Change-Id: Ia9ec983950faa651d31b07fe19934cf4fe389421 Issue-ID: MUSIC-360 Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Diffstat (limited to 'examples/VotingApp')
-rw-r--r--examples/VotingApp/src/main/java/main/VotingApp.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/VotingApp/src/main/java/main/VotingApp.java b/examples/VotingApp/src/main/java/main/VotingApp.java
index 8846ba22..653cef2e 100644
--- a/examples/VotingApp/src/main/java/main/VotingApp.java
+++ b/examples/VotingApp/src/main/java/main/VotingApp.java
@@ -29,6 +29,7 @@ import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
+import java.util.Base64;
import javax.ws.rs.core.MediaType;
@@ -66,13 +67,11 @@ public class VotingApp {
if (!namespace.equals("")) {
builder.header("ns", namespace);
}
- if (!userId.equals("")) {
- builder.header("userId", userId);
+ if (!userId.equals("") && !password.equals("")) {
+ String authString = Base64.getEncoder().encodeToString((userId + ":" + password).getBytes());
+ builder.header("Authorization", "Basic " + authString);
}
- if (!password.equals("")) {
- builder.header("password", password);
- }
-
+
return builder;
}
@@ -511,4 +510,4 @@ public class VotingApp {
}
-} \ No newline at end of file
+}