summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/ConfigHelper.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-04-24 20:01:28 +0200
committerParménides GV <parmegv@sdf.org>2013-04-29 17:09:12 +0200
commit69389ee7db23ce7182b21da08d227d88d6cfdc46 (patch)
treeb521f6c8b86a153b3a126af4ff28b78283de7e84 /src/se/leap/leapclient/ConfigHelper.java
parentbfe2263d6b73159a4f929bc7b1fdeb724c88e8de (diff)
"Trust completely" checkbox saves that trust for the new provider
entered, so that if in the future the client tries to log in or whatever, it can use the certificate downloaded when added. Log in dialog works ok, showing a toast when authentication fails (by this time, I have not managed to get a correct login due to dev.bitmask.net problems). dev.bitmask.net works perfectly, via adding it as a new provider (MeanderingCode, this is for you ;) ). All GET requests are done by default Android URL class, which means that certificates trusted by Android are also trusted by us. If there are problems when logging in due to certificates, the app is able to use only the certificate associated to the provider in the moment it was selected as the chosen provider.
Diffstat (limited to 'src/se/leap/leapclient/ConfigHelper.java')
-rw-r--r--src/se/leap/leapclient/ConfigHelper.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/se/leap/leapclient/ConfigHelper.java b/src/se/leap/leapclient/ConfigHelper.java
index 78c71cc4..7c52629b 100644
--- a/src/se/leap/leapclient/ConfigHelper.java
+++ b/src/se/leap/leapclient/ConfigHelper.java
@@ -16,6 +16,7 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
+import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -44,7 +45,7 @@ public class ConfigHelper {
public static final String user_directory = "leap_android";
final public static String provider_main_url = "provider_main_url";
final public static String danger_on = "danger_on";
- final public static String api_url_key = "srp_server_url";
+ final public static String api_url_key = "api_uri";
final public static String username_key = "username";
final public static String password_key = "password";
final public static String eip_service_api_path = "/config/eip-service.json";
@@ -63,6 +64,20 @@ public class ConfigHelper {
final public static int LOGOUT_SUCCESSFUL = 7;
final public static int LOGOUT_FAILED = 8;
+ static String getStringFromSharedPref(String shared_preferences_key) {
+ String value = "";
+ String content = shared_preferences.getString(shared_preferences_key, "");
+ try {
+ JSONObject json_object = new JSONObject(content);
+ JSONArray names = json_object.names();
+ String key = names.getString(0);
+ value = json_object.getString(key);
+ } catch (JSONException e) {
+ value = content;
+ }
+ return value;
+ }
+
static void saveSharedPref(String shared_preferences_key, JSONObject content) {
SharedPreferences.Editor shared_preferences_editor = shared_preferences
@@ -164,8 +179,8 @@ public class ConfigHelper {
try {
// Initialize the keystore with the provided trusted certificates
// Also provide the password of the keystore
- keystore_trusted.load(leap_keystore, "uer92jf".toCharArray());
- //keystore_trusted.load(null, null);
+ //keystore_trusted.load(leap_keystore, "uer92jf".toCharArray());
+ keystore_trusted.load(null, null);
} finally {
leap_keystore.close();
}