\r
package com.owncloud.android.authentication;\r
\r
-import java.net.URLDecoder;\r
-\r
import android.accounts.Account;\r
import android.accounts.AccountManager;\r
import android.app.AlertDialog;\r
import android.widget.EditText;\r
import android.widget.TextView;\r
import android.widget.TextView.OnEditorActionListener;\r
-import android.widget.Toast;\r
\r
import com.actionbarsherlock.app.SherlockDialogFragment;\r
import com.owncloud.android.Log_OC;\r
// NOTHING TO DO ; can't find out what situation that leads to the exception in this code, but user logs signal that it happens\r
}\r
\r
- if (result.isTemporalRedirection() || result.isIdPRedirection()) {\r
+ if (result.isTemporalRedirection() && result.isIdPRedirection()) {\r
String url = result.getRedirectedLocation();\r
String targetUrl = mHostBaseUrl + AccountUtils.getWebdavPath(mDiscoveredVersion, mCurrentAuthTokenType);\r
\r
response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken);\r
// the next line is necessary; by now, notifications are calling directly to the AuthenticatorActivity to update, without AccountManager intervention\r
mAccountMgr.setAuthToken(mAccount, mCurrentAuthTokenType, mAuthToken);\r
- Log_OC.e(TAG, "saving auth token: " + mAuthToken);\r
\r
} else {\r
response.putString(AccountManager.KEY_AUTHTOKEN, mPasswordInput.getText().toString());\r
intent.putExtra(AccountManager.KEY_USERDATA, username);\r
if (isOAuth || isSaml) {\r
mAccountMgr.setAuthToken(mAccount, mCurrentAuthTokenType, mAuthToken);\r
- Log_OC.e(TAG, "saving auth token: " + mAuthToken);\r
}\r
/// add user data to the new account; TODO probably can be done in the last parameter addAccountExplicitly, or in KEY_USERDATA\r
mAccountMgr.setUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION, mDiscoveredVersion.toString());\r
Notification finalNotification = new Notification(R.drawable.icon, getString(tickerId), System.currentTimeMillis());
finalNotification.flags |= Notification.FLAG_AUTO_CANCEL;
boolean needsToUpdateCredentials = (downloadResult.getCode() == ResultCode.UNAUTHORIZED ||
- ((downloadResult.isTemporalRedirection() || downloadResult.isIdPRedirection())
+ (downloadResult.isTemporalRedirection() && downloadResult.isIdPRedirection()
&& AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mDownloadClient.getAuthTokenType())));
if (needsToUpdateCredentials) {
// let the user update credentials with one click
String content = null;
boolean needsToUpdateCredentials = (uploadResult.getCode() == ResultCode.UNAUTHORIZED ||
- ((uploadResult.isTemporalRedirection() || uploadResult.isIdPRedirection())
- && AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mUploadClient.getAuthTokenType())));
+ (uploadResult.isTemporalRedirection() && uploadResult.isIdPRedirection() &&
+ AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mUploadClient.getAuthTokenType())));
if (needsToUpdateCredentials) {
// let the user update credentials with one click
Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
} else if (isSamlSso) { // TODO avoid a call to getUserData here
String accessToken = am.blockingGetAuthToken(account, AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE, false);
client.setSsoSessionCookie(accessToken);
- Log_OC.e(TAG, "client with auth token: " + accessToken);
} else {
String username = account.name.substring(0, account.name.lastIndexOf('@'));
String accessToken = result.getString(AccountManager.KEY_AUTHTOKEN);
if (accessToken == null) throw new AuthenticatorException("WTF!");
client.setSsoSessionCookie(accessToken);
- Log_OC.e(TAG, "client with auth token: " + accessToken);
} else {
String username = account.name.substring(0, account.name.lastIndexOf('@'));
repeat = false;
if (mCallerActivity != null && mAccount != null && mContext != null && !result.isSuccess() &&
- (result.getCode() == ResultCode.UNAUTHORIZED || result.isTemporalRedirection() || result.isIdPRedirection())) {
+ (result.getCode() == ResultCode.UNAUTHORIZED || (result.isTemporalRedirection() && result.isIdPRedirection()))) {
/// possible fail due to lack of authorization in an operation performed in foreground
Credentials cred = mClient.getCredentials();
String ssoSessionCookie = mClient.getSsoSessionCookie();
} else {
if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED ||
- ((result.isTemporalRedirection() || result.isIdPRedirection()) && getClient().getSsoSessionCookie() != null)) {
+ (result.isTemporalRedirection() && result.isIdPRedirection() &&
+ AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
notification.flags |= Notification.FLAG_AUTO_CANCEL;
boolean needsToUpdateCredentials = (mLastFailedResult != null &&
( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED ||
- ((mLastFailedResult.isTemporalRedirection() || mLastFailedResult.isIdPRedirection())
- && AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))
+ (mLastFailedResult.isTemporalRedirection() && mLastFailedResult.isIdPRedirection() &&
+ AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))
)
);
// TODO put something smart in the contentIntent below for all the possible errors