X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/d2ff7d47553944206bcb904b423fa33b91ef0977..aae90eb1aa42a11449e30330e3e23e1e9e5eebb6:/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java diff --git a/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java b/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java index 560109f0..b90c25e9 100644 --- a/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java +++ b/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java @@ -69,6 +69,7 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation { * Constructor * * @param context Android context of the caller. + * @param webdavUrl */ public DetectAuthenticationMethodOperation(Context context) { mContext = context; @@ -90,14 +91,17 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation { AuthenticationMethod authMethod = AuthenticationMethod.UNKNOWN; RemoteOperation operation = new ExistenceCheckRemoteOperation("", mContext, false); - client.setBasicCredentials("", ""); + client.clearCredentials(); client.setFollowRedirects(false); // try to access the root folder, following redirections but not SAML SSO redirections result = operation.execute(client); - while (result.isTemporalRedirection() && !result.isIdPRedirection()) { - client.setWebdavUri(Uri.parse(result.getRedirectedLocation())); + String redirectedLocation = result.getRedirectedLocation(); + while (redirectedLocation != null && redirectedLocation.length() > 0 && + !result.isIdPRedirection()) { + client.setBaseUri(Uri.parse(result.getRedirectedLocation())); result = operation.execute(client); + redirectedLocation = result.getRedirectedLocation(); } // analyze response @@ -120,6 +124,9 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation { // else - fall back to UNKNOWN Log.d(TAG, "Authentication method found: " + authenticationMethodToString(authMethod)); + if (!authMethod.equals(AuthenticationMethod.UNKNOWN)) { + result = new RemoteOperationResult(true, result.getHttpCode(), null); + } ArrayList data = new ArrayList(); data.add(authMethod); result.setData(data);