import com.owncloud.android.MainApp;\r
import com.owncloud.android.R;\r
import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;\r
+import com.owncloud.android.lib.common.OwnCloudAccount;\r
+import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;\r
+import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;\r
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;\r
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;\r
import com.owncloud.android.operations.DetectAuthenticationMethodOperation.AuthenticationMethod;\r
Intent getServerInfoIntent = new Intent();\r
getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO);\r
getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, uri);\r
- getServerInfoIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN_TYPE, mAuthTokenType);\r
if (mOperationsServiceBinder != null) {\r
- //Log_OC.wtf(TAG, "checking server..." );\r
mWaitingForOpId = mOperationsServiceBinder.newOperation(getServerInfoIntent);\r
} else {\r
Log_OC.wtf(TAG, "Server check tried with OperationService unbound!" );\r
* 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
IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);\r
dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);\r
\r
- /// test credentials accessing the root folder\r
- String remotePath ="";\r
- boolean successIfAbsent = false;\r
- boolean followRedirects = true;\r
- startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, username, password, followRedirects);\r
+ /// validate credentials accessing the root folder\r
+ accessRootFolderRemoteOperation(username, password);\r
\r
}\r
\r
- private void startExistenceCheckRemoteOperation(String remotePath, Context context, boolean successIfAbsent, String webdav_path,\r
- String username, String password, boolean followRedirects) {\r
+ private void accessRootFolderRemoteOperation(String username, String password) {\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_REMOTE_PATH, "/");\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password);\r
existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken);\r
- existenceCheckIntent.putExtra(OperationsService.EXTRA_FOLLOW_REDIRECTS, followRedirects);\r
\r
if (mOperationsServiceBinder != null) {\r
//Log_OC.wtf(TAG, "starting existenceCheckRemoteOperation..." );\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
+ /// validate credentials accessing the root folder\r
+ accessRootFolderRemoteOperation("", "");\r
\r
}\r
\r
\r
if (!mUsernameInput.getText().toString().equals(username)) {\r
// fail - not a new account, but an existing one; disallow\r
- result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); \r
+ result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME);\r
+ /*\r
+ OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(\r
+ new OwnCloudAccount(\r
+ Uri.parse(mServerInfo.mBaseUrl),\r
+ OwnCloudCredentialsFactory.newSamlSsoCredentials(mAuthToken))\r
+ );\r
+ */\r
+ mAuthToken = "";\r
updateAuthStatusIconAndText(result);\r
showAuthStatus();\r
Log_OC.d(TAG, result.getLogMessage());\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
//mAuthToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Constants.KEY_ACCESS_TOKEN);\r
Log_OC.d(TAG, "Got ACCESS TOKEN: " + mAuthToken);\r
\r
- String remotePath ="";\r
- boolean successIfAbsent = false;\r
- boolean followRedirects = true;\r
- startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirects);\r
+ accessRootFolderRemoteOperation("", "");\r
\r
} else {\r
updateAuthStatusIconAndText(result);\r
getUserNameIntent.setAction(OperationsService.ACTION_GET_USER_NAME);\r
getUserNameIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);\r
getUserNameIntent.putExtra(OperationsService.EXTRA_COOKIE, sessionCookie);\r
- getUserNameIntent.putExtra(OperationsService.EXTRA_FOLLOW_REDIRECTS, followRedirects);\r
\r
if (mOperationsServiceBinder != null) {\r
//Log_OC.wtf(TAG, "starting getRemoteUserNameOperation..." );\r