Hack to disable SSL for gapines and mlnc4.mvlcstaff.org. This issue is described...
authorkenstir <kenstir@gmail.com>
Wed, 25 Nov 2015 03:15:52 +0000 (22:15 -0500)
committerkenstir <kenstir@gmail.com>
Wed, 25 Nov 2015 03:15:52 +0000 (22:15 -0500)
Open-ILS/src/Android/core/src/org/evergreen_ils/auth/AuthenticatorActivity.java
Open-ILS/src/Android/core/src/org/evergreen_ils/auth/EvergreenAuthenticator.java
Open-ILS/src/Android/cwmars_app/AndroidManifest.xml
Open-ILS/src/Android/hemlock_app/AndroidManifest.xml
Open-ILS/src/Android/opensrf/src/org/opensrf/net/http/GatewayRequest.java

index 8b2d276..4912d4a 100644 (file)
@@ -28,6 +28,7 @@ import org.evergreen_ils.globals.Utils;
 import org.evergreen_ils.searchCatalog.Library;
 import org.opensrf.util.JSONException;
 import org.opensrf.util.JSONReader;
+import org.w3c.dom.Text;
 
 import java.util.*;
 
@@ -339,8 +340,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity {
         libraries.clear();
 
         if (isDebuggable()) {
-            Library library = new Library("https://demo.evergreencatalog.com", "evergreencatalog.com Demo", "0ut There, US  (evergreencatalog.com Demo)", null);
-            //Library library = new Library("http://mlnc4.mvlcstaff.org", "MVLC Demo", "0ut There, US (MVLC Demo)", null);// SSL not working
+            //Library library = new Library("https://demo.evergreencatalog.com", "evergreencatalog.com Demo", "0ut There, US  (evergreencatalog.com Demo)", null);
+            Library library = new Library(cleartextHack("https://mlnc4.mvlcstaff.org"), "MVLC Demo", "0ut There, US (MVLC Demo)", null);// SSL not working
             libraries.add(library);
         }
 
@@ -354,6 +355,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity {
             }
             for (Map<String, ?> map : l) {
                 String url = (String) map.get("url");
+                url = cleartextHack(url);
                 String directory_name = (String) map.get("directory_name");
                 String short_name = (String) map.get("short_name");
                 Double latitude = (Double) map.get("latitude");
@@ -378,6 +380,21 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity {
         }
     }
 
+    private String cleartextHack(String url) {
+        // fixes SSL issue with gapines and other sites
+        if (TextUtils.equals(url, "https://gapines.org")
+            || TextUtils.equals(url, "https://mlnc4.mvlcstaff.org"))
+        {
+            try {
+                String new_url = url.replaceFirst("^https:", "http:");
+                return new_url;
+            } catch (Exception e) {
+                Log.d(TAG, "caught", e);
+            }
+        }
+        return url;
+    }
+
     public boolean isDebuggable() {
         return (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE));
     }
index 146c8eb..f895396 100644 (file)
@@ -69,7 +69,7 @@ public class EvergreenAuthenticator {
     
     @SuppressWarnings("unchecked")
     public static String signIn(String library_url, String username, String password) throws AuthenticationException {
-        Log.d(TAG, "signIn> "+username);
+        Log.d(TAG, "signIn> "+username+" "+library_url);
 
         HttpConnection conn;
         try {
index a6df465..c1c075d 100644 (file)
@@ -17,6 +17,8 @@
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />
 
     <!-- uses-feature elements are used in Play Store device matching -->
+    <uses-feature android:name="android.hardware.location" android:required="false" />
+    <uses-feature android:name="android.hardware.location.network" android:required="false" />
     <uses-feature android:name="android.hardware.screen.landscape" android:required="false" />
     <uses-feature android:name="android.hardware.screen.portrait" android:required="false" />
     <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
@@ -24,7 +26,7 @@
     <application
         android:allowBackup="true"
         android:icon="@drawable/evergreen_launcher_icon"
-        android:label="@string/ou_library_name"
+        android:label="@string/ou_app_label"
         android:theme="@style/Theme.AppCompat" >
 
         <!-- Notification receiver -->
index 0ca95db..32a87ab 100644 (file)
@@ -2,7 +2,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="net.kenstir.apps.hemlock"
           android:installLocation="auto"
-          android:versionCode="5"
+          android:versionCode="6"
           android:versionName="1.0">
 
     <uses-sdk
@@ -24,6 +24,7 @@
     <uses-feature android:name="android.hardware.screen.landscape" android:required="false" />
     <uses-feature android:name="android.hardware.screen.portrait" android:required="false" />
     <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
+
     <application
         android:allowBackup="true"
         android:icon="@drawable/evergreen_launcher_icon"
index 26066e9..aa9051a 100644 (file)
@@ -51,6 +51,7 @@ public class GatewayRequest extends HttpRequest {
         } catch (java.io.IOException ex) {
             failed = true;
             failure = ex;
+            Log.d(TAG, "caught exception", ex);
         }
 
         return this;
@@ -101,6 +102,7 @@ public class GatewayRequest extends HttpRequest {
         } catch (java.io.IOException ex) { 
             failed = true;
             failure = ex;
+            Log.d(TAG, "caught exception", ex);
         }
 
         readComplete = true;
@@ -139,7 +141,7 @@ public class GatewayRequest extends HttpRequest {
             // not using URLEncoder because it replaces ' ' with '+'.
             uri = new URI("http", "", null, postData.toString(), null);
         } catch (java.net.URISyntaxException ex) {
-            ex.printStackTrace(); 
+            Log.d(TAG, "caught exception", ex);
         }
 
         return uri.getRawQuery();