X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/1bda7e1e872273e48cc5bf1ae8f289e6d03f00ab..cbdcf7d4572d90a76a4042ce6dbb3552e46b5fd0:/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..b817e724 100644 --- a/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java +++ b/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java @@ -64,14 +64,17 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation { } private Context mContext; + private String mWebDavUrl; /** * Constructor * * @param context Android context of the caller. + * @param webdavUrl */ - public DetectAuthenticationMethodOperation(Context context) { + public DetectAuthenticationMethodOperation(Context context, String webdavUrl) { mContext = context; + mWebDavUrl = webdavUrl; } @@ -90,14 +93,17 @@ public class DetectAuthenticationMethodOperation extends RemoteOperation { AuthenticationMethod authMethod = AuthenticationMethod.UNKNOWN; RemoteOperation operation = new ExistenceCheckRemoteOperation("", mContext, false); + client.setWebdavUri(Uri.parse(mWebDavUrl)); client.setBasicCredentials("", ""); 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()) { + String redirectedLocation = result.getRedirectedLocation(); + while (redirectedLocation != null && redirectedLocation.length() > 0 && !result.isIdPRedirection()) { client.setWebdavUri(Uri.parse(result.getRedirectedLocation())); result = operation.execute(client); + redirectedLocation = result.getRedirectedLocation(); } // analyze response @@ -120,6 +126,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);