summaryrefslogtreecommitdiffstats
path: root/examples/VotingApp
diff options
context:
space:
mode:
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
+}