* the root folder of the ownCloud server.\r
*/\r
private void checkBasicAuthorization() {\r
- /// get the path to the root folder through WebDAV from the version server\r
- String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
-\r
/// get basic credentials entered by user\r
String username = mUsernameInput.getText().toString();\r
String password = mPasswordInput.getText().toString();\r
String remotePath ="";\r
boolean successIfAbsent = false;\r
boolean followRedirects = true;\r
- startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, username, password, followRedirects);\r
+ startExistenceCheckRemoteOperation(\r
+ remotePath, this, successIfAbsent, username, password, followRedirects);\r
\r
}\r
\r
- private void startExistenceCheckRemoteOperation(String remotePath, Context context, boolean successIfAbsent, String webdav_path,\r
+ private void startExistenceCheckRemoteOperation(\r
+ String remotePath, Context context, boolean successIfAbsent,\r
String username, String password, boolean followRedirects) {\r
Intent existenceCheckIntent = new Intent();\r
existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_SUCCESS_IF_ABSENT, successIfAbsent);\r
- existenceCheckIntent.putExtra(OperationsService.EXTRA_WEBDAV_PATH, webdav_path);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken);\r
IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);\r
dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);\r
\r
- /// get the path to the root folder through WebDAV from the version server\r
- String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
-\r
/// test credentials accessing the root folder\r
String remotePath ="";\r
boolean successIfAbsent = false;\r
boolean followRedirections = false;\r
- startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirections);\r
+ startExistenceCheckRemoteOperation(\r
+ remotePath, this, successIfAbsent, "", "", followRedirections);\r
\r
}\r
\r
mWaitingForOpId = Long.MAX_VALUE;\r
dismissDialog(WAIT_DIALOG_TAG);\r
\r
- String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
- if (result.isSuccess() && webdav_path != null) {\r
+ if (result.isSuccess()) {\r
/// be gentle with the user\r
IndeterminateProgressDialog dialog = \r
IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);\r
String remotePath ="";\r
boolean successIfAbsent = false;\r
boolean followRedirects = true;\r
- startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirects);\r
+ startExistenceCheckRemoteOperation(\r
+ remotePath, this, successIfAbsent, "", "", followRedirects);\r
\r
} else {\r
updateAuthStatusIconAndText(result);\r
AuthenticationMethod authMethod = AuthenticationMethod.UNKNOWN;
RemoteOperation operation = new ExistenceCheckRemoteOperation("", mContext, false);
- client.setWebdavUri(Uri.parse(mWebDavUrl));
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();
}
public static final String EXTRA_RESULT = "RESULT";
// TODO review if ALL OF THEM are necessary
- public static final String EXTRA_WEBDAV_PATH = "WEBDAV_PATH";
public static final String EXTRA_SUCCESS_IF_ABSENT = "SUCCESS_IF_ABSENT";
public static final String EXTRA_USERNAME = "USERNAME";
public static final String EXTRA_PASSWORD = "PASSWORD";
private static class Target {
public Uri mServerUrl = null;
public Account mAccount = null;
- public String mWebDavUrl = null;
public String mUsername = null;
public String mPassword = null;
public String mAuthToken = null;
public boolean mFollowRedirects = true;
public String mCookie = null;
- public Target(Account account, Uri serverUrl, String webdavUrl, String username, String password, String authToken,
+ public Target(Account account, Uri serverUrl, String username, String password, String authToken,
boolean followRedirects, String cookie) {
mAccount = account;
mServerUrl = serverUrl;
- mWebDavUrl = webdavUrl;
mUsername = username;
mPassword = password;
mAuthToken = authToken;
} else {
Account account = operationIntent.getParcelableExtra(EXTRA_ACCOUNT);
String serverUrl = operationIntent.getStringExtra(EXTRA_SERVER_URL);
- String webDavPath = operationIntent.getStringExtra(EXTRA_WEBDAV_PATH);
- String webDavUrl = serverUrl + webDavPath;
String username = operationIntent.getStringExtra(EXTRA_USERNAME);
String password = operationIntent.getStringExtra(EXTRA_PASSWORD);
String authToken = operationIntent.getStringExtra(EXTRA_AUTH_TOKEN);
target = new Target(
account,
(serverUrl == null) ? null : Uri.parse(serverUrl),
- ((webDavPath == null) || (serverUrl == null)) ? null : webDavUrl,
username,
password,
authToken,
mLastTarget.mServerUrl,
credentials, // still can be null, and that is right
this);
-
- if (mLastTarget.mWebDavUrl != null) {
- mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl));
- }
mOwnCloudClient.setFollowRedirects(mLastTarget.mFollowRedirects);
mStorageManager = null;
}