Load SAML log-in dialog from the original URL so that cookies returned with the redir...
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / SsoWebViewClient.java
index fb078bd..60178a8 100644 (file)
@@ -24,6 +24,9 @@ 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.owncloud.android.lib.common.utils.Log_OC;
+
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.net.http.SslCertificate;
@@ -40,9 +43,6 @@ 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 
@@ -120,11 +120,11 @@ public class SsoWebViewClient extends WebViewClient {
     public void onPageFinished (WebView view, String url) {
         Log_OC.d(TAG, "onPageFinished : " + url);
         mLastReloadedUrlAtError = null;
+        CookieManager cookieManager = CookieManager.getInstance();
+        final String cookies = cookieManager.getCookie(url);
+        Log_OC.d(TAG, "Cookies: " + cookies);
         if (url.startsWith(mTargetUrl)) {
             view.setVisibility(View.GONE);
-            CookieManager cookieManager = CookieManager.getInstance();
-            final String cookies = cookieManager.getCookie(url);
-            Log_OC.d(TAG, "Cookies: " + cookies);
             if (mListenerHandler != null && mListenerRef != null) {
                 // this is good idea because onPageFinished is not running in the UI thread
                 mListenerHandler.post(new Runnable() {