Improved status messages for authentication through SAML-based federated SSO
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 1 Aug 2013 15:44:23 +0000 (17:44 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 1 Aug 2013 15:44:23 +0000 (17:44 +0200)
res/values/setup.xml
res/values/strings.xml
src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/authentication/SsoWebViewClient.java

index 2c46d41..3e39fab 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="server_url"></string>
+    <string name="server_url">https://bwlsdf-owncloud1.lsdf.kit.edu/oc-shib</string>
     <bool name="show_server_url_input">true</bool>
     
     <!-- Flags to setup the authentication methods available in the app -->
index 30ec04f..f071982 100644 (file)
     <string name="auth_wtf_reenter_URL">Unexpected state; please, enter the server URL again</string>
     <string name="auth_expired_oauth_token_toast">Your authorization expired.\nPlease, authorize again</string>
     <string name="auth_expired_basic_auth_toast">Please, enter the current password</string>
+       <string name="auth_connecting_auth_server">Connecting to authentication server…</string>
+       <string name="auth_follow_auth_server">Follow instructions above to get authenticated</string>
+       <string name="auth_unsupported_auth_method">The server does not support this authentication method</string>    
     
     <string name="crashlog_message">Application terminated unexpectedly. Would you like to submit a crash report?</string>
     <string name="crashlog_send_report">Send report</string>
index e2ab037..f648b6e 100644 (file)
@@ -686,6 +686,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mAuthStatusIcon = R.drawable.progress_small;\r
         mAuthStatusText = R.string.oauth_login_connection;\r
         showAuthStatus();\r
+        \r
 \r
         // GET AUTHORIZATION request\r
         //Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));\r
@@ -710,8 +711,9 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private void startSamlBasedFederatedSingleSignOnAuthorization() {\r
         // be gentle with the user\r
         mAuthStatusIcon = R.drawable.progress_small;\r
-        mAuthStatusText = R.string.oauth_login_connection;\r
+        mAuthStatusText = R.string.auth_connecting_auth_server;\r
         showAuthStatus();\r
+        showDialog(DIALOG_LOGIN_PROGRESS);\r
         \r
         /// get the path to the root folder through WebDAV from the version server\r
         String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType);\r
@@ -738,17 +740,37 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 \r
         } else if (operation instanceof ExistenceCheckOperation)  {\r
             if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mCurrentAuthTokenType)) {\r
-                if (result.isTemporalRedirection()) {\r
-                    String url = result.getRedirectedLocation();\r
-                    mWebViewClient.setTargetUrl(mHostBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType));\r
-                    mSsoWebView.loadUrl(url);\r
-                }\r
+                onSamlBasedFederatedSingleSignOnAuthorizationStart(operation, result);\r
                 \r
             } else {\r
                 onAuthorizationCheckFinish((ExistenceCheckOperation)operation, result);\r
             }\r
         }\r
     }\r
+    \r
+    \r
+    private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperation operation, RemoteOperationResult result) {\r
+        try {\r
+            dismissDialog(DIALOG_LOGIN_PROGRESS);\r
+        } catch (IllegalArgumentException e) {\r
+            // NOTHING TO DO ; can't find out what situation that leads to the exception in this code, but user logs signal that it happens\r
+        }\r
+\r
+        if (result.isTemporalRedirection()) {\r
+            String url = result.getRedirectedLocation();\r
+            mWebViewClient.setTargetUrl(mHostBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType));\r
+            mSsoWebView.loadUrl(url);\r
+            \r
+            mAuthStatusIcon = android.R.drawable.ic_secure;\r
+            mAuthStatusText = R.string.auth_follow_auth_server;\r
+            \r
+        } else {\r
+            mAuthStatusIcon = R.drawable.common_error;\r
+            mAuthStatusText = R.string.auth_unsupported_auth_method;\r
+            \r
+        }\r
+        showAuthStatus();\r
+    }\r
 \r
 \r
     /**\r
index 9d78d6a..ad5ea12 100644 (file)
@@ -77,7 +77,7 @@ public class SsoWebViewClient extends WebViewClient {
     public void onReceivedError (WebView view, int errorCode, String description, String failingUrl) {
         Log_OC.e(TAG, "onReceivedError : " + failingUrl);
     }
-    
+
     /*
 
     @Override
@@ -86,11 +86,6 @@ public class SsoWebViewClient extends WebViewClient {
     }
     
     @Override
-    public void onPageFinished (WebView view, String url) {
-        Log_OC.e(TAG, "onPageFinished : " + url);
-    }
-    
-    @Override
     public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
         Log_OC.e(TAG, "onReceivedSslError : " + error);
     }
@@ -101,6 +96,11 @@ public class SsoWebViewClient extends WebViewClient {
     }
 
     @Override
+    public void onPageFinished (WebView view, String url) {
+        Log_OC.e(TAG, "onPageFinished : " + url);
+    }
+    
+    @Override
     public WebResourceResponse shouldInterceptRequest (WebView view, String url) {
         Log_OC.e(TAG, "shouldInterceptRequest : " + url);
         return null;