Improved status messages for authentication through SAML-based federated SSO
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorActivity.java
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