Done some changes for storing the log messages on log file and grant that logs are...
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / DetectAuthenticationMethodOperation.java
index b817e72..4643bee 100644 (file)
@@ -32,6 +32,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
+import com.owncloud.android.utils.Log_OC;
 
 import android.content.Context;
 import android.net.Uri;
@@ -64,7 +65,6 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
     }
     
     private Context mContext;
-    private String mWebDavUrl;
     
     /**
      * Constructor
@@ -72,9 +72,8 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
      * @param context       Android context of the caller.
      * @param webdavUrl
      */
-    public DetectAuthenticationMethodOperation(Context context, String webdavUrl) {
+    public DetectAuthenticationMethodOperation(Context context) {
         mContext = context;
-        mWebDavUrl = webdavUrl;
     }
     
 
@@ -93,15 +92,15 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
         AuthenticationMethod authMethod = AuthenticationMethod.UNKNOWN;
         
         RemoteOperation operation = new ExistenceCheckRemoteOperation("", mContext, false);
-        client.setWebdavUri(Uri.parse(mWebDavUrl));
-        client.setBasicCredentials("", "");
+        client.clearCredentials();
         client.setFollowRedirects(false);
         
         // try to access the root folder, following redirections but not SAML SSO redirections
         result = operation.execute(client);
         String redirectedLocation = result.getRedirectedLocation(); 
-        while (redirectedLocation != null && redirectedLocation.length() > 0 && !result.isIdPRedirection()) {
-            client.setWebdavUri(Uri.parse(result.getRedirectedLocation()));
+        while (redirectedLocation != null && redirectedLocation.length() > 0 && 
+                !result.isIdPRedirection()) {
+            client.setBaseUri(Uri.parse(result.getRedirectedLocation()));
             result = operation.execute(client);
             redirectedLocation = result.getRedirectedLocation();
         } 
@@ -124,7 +123,7 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation {
             authMethod = AuthenticationMethod.SAML_WEB_SSO;
         }
         // else - fall back to UNKNOWN
-        Log.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
+        Log_OC.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod));
         
         if (!authMethod.equals(AuthenticationMethod.UNKNOWN)) {
             result = new RemoteOperationResult(true, result.getHttpCode(), null);