X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/101cbbe492469265603145640835e244d6e2949a..aae90eb1aa42a11449e30330e3e23e1e9e5eebb6:/src/com/owncloud/android/authentication/SsoWebViewClient.java?ds=inline diff --git a/src/com/owncloud/android/authentication/SsoWebViewClient.java b/src/com/owncloud/android/authentication/SsoWebViewClient.java index 89f66ef2..fb078bdf 100644 --- a/src/com/owncloud/android/authentication/SsoWebViewClient.java +++ b/src/com/owncloud/android/authentication/SsoWebViewClient.java @@ -24,11 +24,6 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import com.owncloud.android.lib.common.network.NetworkUtils; -import com.actionbarsherlock.app.SherlockFragmentActivity; -import com.owncloud.android.ui.dialog.SslUntrustedCertDialogABSTRACT; -import com.owncloud.android.utils.Log_OC; - import android.content.Context; import android.graphics.Bitmap; import android.net.http.SslCertificate; @@ -36,8 +31,6 @@ import android.net.http.SslError; import android.os.Bundle; import android.os.Handler; import android.os.Message; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; import android.view.KeyEvent; import android.view.View; import android.webkit.CookieManager; @@ -47,6 +40,9 @@ import android.webkit.WebResourceResponse; import android.webkit.WebView; import android.webkit.WebViewClient; +import com.owncloud.android.lib.common.network.NetworkUtils; +import com.owncloud.android.utils.Log_OC; + /** * Custom {@link WebViewClient} client aimed to catch the end of a single-sign-on process @@ -70,6 +66,7 @@ public class SsoWebViewClient extends WebViewClient { private WeakReference mListenerRef; private String mTargetUrl; private String mLastReloadedUrlAtError; + public SsoWebViewClient (Context context, Handler listenerHandler, SsoWebViewClientListener listener) { mContext = context; @@ -90,6 +87,7 @@ public class SsoWebViewClient extends WebViewClient { @Override public void onPageStarted (WebView view, String url, Bitmap favicon) { Log_OC.d(TAG, "onPageStarted : " + url); + view.clearCache(true); super.onPageStarted(view, url, favicon); } @@ -168,17 +166,8 @@ public class SsoWebViewClient extends WebViewClient { if (isKnownServer) { handler.proceed(); - } else if (x509Certificate != null) { - // Show a dialog with the certificate info - ((AuthenticatorActivity)mContext).showUntrustedCertDialog(x509Certificate, error); - handler.cancel(); } else { - // Show a dialog with the certificate information available in SslError (not full) - SslUntrustedCertDialogABSTRACT dialog = SslUntrustedCertDialogABSTRACT.newInstanceForEmptySslError(error, handler); - FragmentManager fm = ((SherlockFragmentActivity)mContext).getSupportFragmentManager(); - FragmentTransaction ft = fm.beginTransaction(); - dialog.show(ft, AuthenticatorActivity.DIALOG_UNTRUSTED_CERT); - // let's forward the handler, and see what happens... + ((AuthenticatorActivity)mContext).showUntrustedCertDialog(x509Certificate, error, handler); } } @@ -208,6 +197,8 @@ public class SsoWebViewClient extends WebViewClient { @Override public void onReceivedHttpAuthRequest (WebView view, HttpAuthHandler handler, String host, String realm) { Log_OC.d(TAG, "onReceivedHttpAuthRequest : " + host); + + ((AuthenticatorActivity)mContext).createAuthenticationDialog(view, handler); } @Override @@ -242,5 +233,4 @@ public class SsoWebViewClient extends WebViewClient { Log_OC.d(TAG, "shouldOverrideKeyEvent : " + event); return false; } - }