summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/LeapHttpClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/se/leap/leapclient/LeapHttpClient.java')
-rw-r--r--src/se/leap/leapclient/LeapHttpClient.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/se/leap/leapclient/LeapHttpClient.java b/src/se/leap/leapclient/LeapHttpClient.java
index 00ee15e9..42f9a523 100644
--- a/src/se/leap/leapclient/LeapHttpClient.java
+++ b/src/se/leap/leapclient/LeapHttpClient.java
@@ -11,11 +11,22 @@ import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.SingleClientConnManager;
import android.content.Context;
+/**
+ * Implements an HTTP client, enabling LEAP Android app to manage its own runtime keystore or bypass default Android security measures.
+ *
+ * @author rafa
+ *
+ */
public class LeapHttpClient extends DefaultHttpClient {
final Context context;
private static LeapHttpClient client;
+ /**
+ * If the class scope client is null, it creates one and imports, if existing, the main certificate from Shared Preferences.
+ * @param context
+ * @return the new client.
+ */
public static LeapHttpClient getInstance(Context context) {
if(client == null) {
client = new LeapHttpClient(context);
@@ -36,6 +47,12 @@ public class LeapHttpClient extends DefaultHttpClient {
return new SingleClientConnManager(getParams(), registry);
}
+ /**
+ * Uses keystore from ConfigHelper for the SSLSocketFactory.
+ *
+ * Sets hostname verifier to allow all hostname verifier.
+ * @return
+ */
private SSLSocketFactory newSslSocketFactory() {
try {
KeyStore trusted = ConfigHelper.getKeystore();