summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/ProviderAPI.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-05-01 18:41:05 +0200
committerParménides GV <parmegv@sdf.org>2013-05-01 18:41:05 +0200
commitff3d469a9549e3670e097fc0e49c043c84e7b7d4 (patch)
tree9fb747e05841020f11d062a86df86bdcdd85e689 /src/se/leap/leapclient/ProviderAPI.java
parent09493a9dec5fb235d5c4914eb8f8142e3312e246 (diff)
If the app is restarted with a custom provider selected, the client can
request a log in without certificates problems. I've removed the addition of the certificate when downloaded eip-service.json, because I already do that in LeapHttpClient. Solves issue 2367: https://leap.se/code/issues/2367
Diffstat (limited to 'src/se/leap/leapclient/ProviderAPI.java')
-rw-r--r--src/se/leap/leapclient/ProviderAPI.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java
index 66eb3e60..4a288787 100644
--- a/src/se/leap/leapclient/ProviderAPI.java
+++ b/src/se/leap/leapclient/ProviderAPI.java
@@ -93,7 +93,7 @@ public class ProviderAPI extends IntentService {
boolean danger_on = task.getBoolean(ConfigHelper.danger_on);
try {
String cert_string = getStringFromProvider(cert_url, danger_on);
- ConfigHelper.addTrustedCertificate(provider_name, cert_string);
+ //ConfigHelper.addTrustedCertificate(provider_name, cert_string);
JSONObject cert_json = new JSONObject("{ \"certificate\" : \"" + cert_string + "\"}");
ConfigHelper.saveSharedPref(ConfigHelper.cert_key, cert_json);
JSONObject eip_service_json = getJSONFromProvider(eip_service_json_url, danger_on);
@@ -177,9 +177,11 @@ public class ProviderAPI extends IntentService {
if(!json_response.isNull("errors") || json_response.has("errors")) {
return new JSONObject();
}
+
+ String session_id = "";
List<Cookie> cookies = client.getCookieStore().getCookies();
if(!cookies.isEmpty()) {
- String session_id = cookies.get(0).getValue();
+ session_id = cookies.get(0).getValue();
}
return json_response;
}
@@ -190,6 +192,8 @@ public class ProviderAPI extends IntentService {
HttpPut put = new HttpPut(server_url + "/sessions/" + username +".json" + "?" + parameter_chain);
HttpContext localContext = new BasicHttpContext();
localContext.setAttribute(ClientContext.COOKIE_STORE, client.getCookieStore());
+ String session_id = client.getCookieStore().getCookies().get(0).getValue();
+ int number_of_cookies = client.getCookieStore().getCookies().size();
HttpResponse getResponse = client.execute(put, localContext);
HttpEntity responseEntity = getResponse.getEntity();