From 5ede3e9909ab292ea4b8c55b088b190d66acb6e9 Mon Sep 17 00:00:00 2001 From: "David A. Velasco" Date: Thu, 1 Aug 2013 17:44:23 +0200 Subject: [PATCH] Improved status messages for authentication through SAML-based federated SSO --- res/values/setup.xml | 2 +- res/values/strings.xml | 3 ++ .../authentication/AuthenticatorActivity.java | 34 ++++++++++++++++++---- .../android/authentication/SsoWebViewClient.java | 12 ++++---- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/res/values/setup.xml b/res/values/setup.xml index 2c46d415..3e39fabb 100644 --- a/res/values/setup.xml +++ b/res/values/setup.xml @@ -1,6 +1,6 @@ - + https://bwlsdf-owncloud1.lsdf.kit.edu/oc-shib true diff --git a/res/values/strings.xml b/res/values/strings.xml index 30ec04f3..f0719826 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -211,6 +211,9 @@ Unexpected state; please, enter the server URL again Your authorization expired.\nPlease, authorize again Please, enter the current password + Connecting to authentication server… + Follow instructions above to get authenticated + The server does not support this authentication method Application terminated unexpectedly. Would you like to submit a crash report? Send report diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index e2ab0378..f648b6ef 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -686,6 +686,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList mAuthStatusIcon = R.drawable.progress_small; mAuthStatusText = R.string.oauth_login_connection; showAuthStatus(); + // GET AUTHORIZATION request //Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth)); @@ -710,8 +711,9 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList private void startSamlBasedFederatedSingleSignOnAuthorization() { // be gentle with the user mAuthStatusIcon = R.drawable.progress_small; - mAuthStatusText = R.string.oauth_login_connection; + mAuthStatusText = R.string.auth_connecting_auth_server; showAuthStatus(); + showDialog(DIALOG_LOGIN_PROGRESS); /// get the path to the root folder through WebDAV from the version server String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType); @@ -738,17 +740,37 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList } else if (operation instanceof ExistenceCheckOperation) { if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mCurrentAuthTokenType)) { - if (result.isTemporalRedirection()) { - String url = result.getRedirectedLocation(); - mWebViewClient.setTargetUrl(mHostBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType)); - mSsoWebView.loadUrl(url); - } + onSamlBasedFederatedSingleSignOnAuthorizationStart(operation, result); } else { onAuthorizationCheckFinish((ExistenceCheckOperation)operation, result); } } } + + + private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperation operation, RemoteOperationResult result) { + try { + dismissDialog(DIALOG_LOGIN_PROGRESS); + } catch (IllegalArgumentException e) { + // NOTHING TO DO ; can't find out what situation that leads to the exception in this code, but user logs signal that it happens + } + + if (result.isTemporalRedirection()) { + String url = result.getRedirectedLocation(); + mWebViewClient.setTargetUrl(mHostBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType)); + mSsoWebView.loadUrl(url); + + mAuthStatusIcon = android.R.drawable.ic_secure; + mAuthStatusText = R.string.auth_follow_auth_server; + + } else { + mAuthStatusIcon = R.drawable.common_error; + mAuthStatusText = R.string.auth_unsupported_auth_method; + + } + showAuthStatus(); + } /** diff --git a/src/com/owncloud/android/authentication/SsoWebViewClient.java b/src/com/owncloud/android/authentication/SsoWebViewClient.java index 9d78d6a8..ad5ea12d 100644 --- a/src/com/owncloud/android/authentication/SsoWebViewClient.java +++ b/src/com/owncloud/android/authentication/SsoWebViewClient.java @@ -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; -- 2.11.0