From: masensio Date: Fri, 28 Mar 2014 13:51:36 +0000 (+0100) Subject: Add webdav url to DetectAuthenticationMethodOperation X-Git-Tag: oc-android-1.7.0_signed~345^2~20 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/281212045672b8439f09e50896d90a1f5c7524f1?ds=inline;hp=--cc Add webdav url to DetectAuthenticationMethodOperation --- 281212045672b8439f09e50896d90a1f5c7524f1 diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 638b5dd8..cf768833 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -518,7 +518,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { // refresh button enabled outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, (mRefreshButton.getVisibility() == View.VISIBLE)); - } @@ -538,7 +537,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { } } - /** * The redirection triggered by the OAuth authentication server as response to the GET AUTHORIZATION, and * deferred in {@link #onNewIntent(Intent)}, is processed here. @@ -1014,11 +1012,14 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { private void detectAuthorizationMethod() { Log_OC.d(TAG, "Trying empty authorization to detect authentication method"); - + + String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, mAuthTokenType); + /// test credentials - Intent service = new Intent(this, OperationsService.class); + Intent service = new Intent(this, OperationsService.class); service.setAction(OperationsService.ACTION_DETECT_AUTHENTICATION_METHOD); service.putExtra(OperationsService.EXTRA_SERVER_URL, mHostBaseUrl); + service.putExtra(OperationsService.EXTRA_WEBDAV_PATH, webdav_path); startService(service); } diff --git a/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java b/src/com/owncloud/android/operations/DetectAuthenticationMethodOperation.java index c6703161..6bc87503 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,6 +93,7 @@ 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); diff --git a/src/com/owncloud/android/services/OperationsService.java b/src/com/owncloud/android/services/OperationsService.java index 4d1789e7..0df160aa 100644 --- a/src/com/owncloud/android/services/OperationsService.java +++ b/src/com/owncloud/android/services/OperationsService.java @@ -59,6 +59,7 @@ public class OperationsService extends Service { public static final String EXTRA_REMOTE_PATH = "REMOTE_PATH"; public static final String EXTRA_SEND_INTENT = "SEND_INTENT"; public static final String EXTRA_RESULT = "RESULT"; + public static final String EXTRA_WEBDAV_PATH = "WEBDAV_PATH"; public static final String ACTION_CREATE_SHARE = "CREATE_SHARE"; public static final String ACTION_UNSHARE = "UNSHARE"; @@ -136,7 +137,8 @@ public class OperationsService extends Service { operation = new UnshareLinkOperation(remotePath, this.getApplicationContext()); } } else if (action.equals(ACTION_DETECT_AUTHENTICATION_METHOD)) { // Detect Authentication Method - operation = new DetectAuthenticationMethodOperation(this.getApplicationContext()); + String webdav_url = serverUrl + intent.getStringExtra(EXTRA_WEBDAV_PATH); + operation = new DetectAuthenticationMethodOperation(this.getApplicationContext(), webdav_url); } else { // nothing we are going to handle