+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="account_type">owncloud</string>
- <string name="authority">org.owncloud</string>
-</resources>
-
+++ /dev/null
-package com.owncloud.android.oc_framework;
-
-import android.app.Application;
-import android.content.Context;
-
-public class MainApp extends Application {
-
- private static Context mContext;
-
- public void onCreate(){
- super.onCreate();
- MainApp.mContext = getApplicationContext();
- }
-
- public static Context getAppContext() {
- return MainApp.mContext;
- }
-
- // Methods to obtain Strings referring app_name
- // From AccountAuthenticator
- // public static final String ACCOUNT_TYPE = "owncloud";
- public static String getAccountType() {
- return getAppContext().getResources().getString(R.string.account_type);
- }
-
- // From AccountAuthenticator
- // public static final String AUTHORITY = "org.owncloud";
- public static String getAuthority() {
- return getAppContext().getResources().getString(R.string.authority);
- }
-
- // From AccountAuthenticator
- // public static final String AUTH_TOKEN_TYPE = "org.owncloud";
- public static String getAuthTokenType() {
- return getAppContext().getResources().getString(R.string.authority);
- }
-
- // From AccountAuthenticator
- // public static final String AUTH_TOKEN_TYPE_PASSWORD = "owncloud.password";
- public static String getAuthTokenTypePass() {
- return getAppContext().getResources().getString(R.string.account_type) + ".password";
- }
-
- // From AccountAuthenticator
- // public static final String AUTH_TOKEN_TYPE_ACCESS_TOKEN = "owncloud.oauth2.access_token";
- public static String getAuthTokenTypeAccessToken() {
- return getAppContext().getResources().getString(R.string.account_type) + ".oauth2.access_token";
- }
-
- // From AccountAuthenticator
- // public static final String AUTH_TOKEN_TYPE_REFRESH_TOKEN = "owncloud.oauth2.refresh_token";
- public static String getAuthTokenTypeRefreshToken() {
- return getAppContext().getResources().getString(R.string.account_type) + ".oauth2.refresh_token";
- }
-
- // From AccountAuthenticator
- // public static final String AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE = "owncloud.saml.web_sso.session_cookie";
- public static String getAuthTokenTypeSamlSessionCookie() {
- return getAppContext().getResources().getString(R.string.account_type) + ".saml.web_sso.session_cookie";
- }
-
-}
--- /dev/null
+package com.owncloud.android.oc_framework.authentication;
+
+import android.accounts.Account;
+
+public class AccountTypeUtils {
+
+ // Methods to obtain Strings referring account_type
+ public static String getAccountType(Account account) {
+ return account.type;
+ }
+
+
+ // public static final String AUTH_TOKEN_TYPE_PASSWORD = "owncloud.password";
+ public static String getAuthTokenTypePass(Account account) {
+ return account.type + ".password";
+ }
+
+ // public static final String AUTH_TOKEN_TYPE_ACCESS_TOKEN = "owncloud.oauth2.access_token";
+ public static String getAuthTokenTypeAccessToken(Account account) {
+ return account.type + ".oauth2.access_token";
+ }
+
+ // public static final String AUTH_TOKEN_TYPE_REFRESH_TOKEN = "owncloud.oauth2.refresh_token";
+ public static String getAuthTokenTypeRefreshToken(Account account) {
+ return account.type + ".oauth2.refresh_token";
+ }
+
+ // public static final String AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE = "owncloud.saml.web_sso.session_cookie";
+ public static String getAuthTokenTypeSamlSessionCookie(Account account) {
+ return account.type + ".saml.web_sso.session_cookie";
+ }
+
+}
package com.owncloud.android.oc_framework.authentication;
-import com.owncloud.android.oc_framework.MainApp;
import com.owncloud.android.oc_framework.OwnCloudVersion;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountsException;
import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
public class AccountUtils {
public static final String WEBDAV_PATH_1_2 = "/webdav/owncloud.php";
public static final String CARDDAV_PATH_4_0 = "/remote/carddav.php";
public static final String STATUS_PATH = "/status.php";
- /**
- * Can be used to get the currently selected ownCloud {@link Account} in the
- * application preferences.
- *
- * @param context The current application {@link Context}
- * @return The ownCloud {@link Account} currently saved in preferences, or the first
- * {@link Account} available, if valid (still registered in the system as ownCloud
- * account). If none is available and valid, returns null.
- */
- public static Account getCurrentOwnCloudAccount(Context context) {
- Account[] ocAccounts = AccountManager.get(context).getAccountsByType(
- MainApp.getAccountType());
- Account defaultAccount = null;
-
- SharedPreferences appPreferences = PreferenceManager
- .getDefaultSharedPreferences(context);
- String accountName = appPreferences
- .getString("select_oc_account", null);
-
- // account validation: the saved account MUST be in the list of ownCloud Accounts known by the AccountManager
- if (accountName != null) {
- for (Account account : ocAccounts) {
- if (account.name.equals(accountName)) {
- defaultAccount = account;
- break;
- }
- }
- }
-
- if (defaultAccount == null && ocAccounts.length != 0) {
- // take first account as fallback
- defaultAccount = ocAccounts[0];
- }
-
- return defaultAccount;
- }
-
-
- public static boolean exists(Account account, Context context) {
- Account[] ocAccounts = AccountManager.get(context).getAccountsByType(
- MainApp.getAccountType());
-
- if (account != null && account.name != null) {
- for (Account ac : ocAccounts) {
- if (ac.name.equals(account.name)) {
- return true;
- }
- }
- }
- return false;
- }
-
-
- /**
- * Checks, whether or not there are any ownCloud accounts setup.
- *
- * @return true, if there is at least one account.
- */
- public static boolean accountsAreSetup(Context context) {
- AccountManager accMan = AccountManager.get(context);
- Account[] accounts = accMan
- .getAccountsByType(MainApp.getAccountType());
- return accounts.length > 0;
- }
-
-
- public static boolean setCurrentOwnCloudAccount(Context context, String accountName) {
- boolean result = false;
- if (accountName != null) {
- Account[] ocAccounts = AccountManager.get(context).getAccountsByType(
- MainApp.getAccountType());
- boolean found = false;
- for (Account account : ocAccounts) {
- found = (account.name.equals(accountName));
- if (found) {
- SharedPreferences.Editor appPrefs = PreferenceManager
- .getDefaultSharedPreferences(context).edit();
- appPrefs.putString("select_oc_account", accountName);
-
- appPrefs.commit();
- result = true;
- break;
- }
- }
- }
- return result;
- }
+// /**
+// * Can be used to get the currently selected ownCloud {@link Account} in the
+// * application preferences.
+// *
+// * @param context The current application {@link Context}
+// * @return The ownCloud {@link Account} currently saved in preferences, or the first
+// * {@link Account} available, if valid (still registered in the system as ownCloud
+// * account). If none is available and valid, returns null.
+// */
+// public static Account getCurrentOwnCloudAccount(Context context) {
+// Account[] ocAccounts = AccountManager.get(context).getAccountsByType(
+// MainApp.getAccountType());
+// Account defaultAccount = null;
+//
+// SharedPreferences appPreferences = PreferenceManager
+// .getDefaultSharedPreferences(context);
+// String accountName = appPreferences
+// .getString("select_oc_account", null);
+//
+// // account validation: the saved account MUST be in the list of ownCloud Accounts known by the AccountManager
+// if (accountName != null) {
+// for (Account account : ocAccounts) {
+// if (account.name.equals(accountName)) {
+// defaultAccount = account;
+// break;
+// }
+// }
+// }
+//
+// if (defaultAccount == null && ocAccounts.length != 0) {
+// // take first account as fallback
+// defaultAccount = ocAccounts[0];
+// }
+//
+// return defaultAccount;
+// }
+//
+//
+// public static boolean exists(Account account, Context context) {
+// Account[] ocAccounts = AccountManager.get(context).getAccountsByType(
+// MainApp.getAccountType());
+//
+// if (account != null && account.name != null) {
+// for (Account ac : ocAccounts) {
+// if (ac.name.equals(account.name)) {
+// return true;
+// }
+// }
+// }
+// return false;
+// }
+//
+//
+// /**
+// * Checks, whether or not there are any ownCloud accounts setup.
+// *
+// * @return true, if there is at least one account.
+// */
+// public static boolean accountsAreSetup(Context context) {
+// AccountManager accMan = AccountManager.get(context);
+// Account[] accounts = accMan
+// .getAccountsByType(MainApp.getAccountType());
+// return accounts.length > 0;
+// }
+//
+//
+// public static boolean setCurrentOwnCloudAccount(Context context, String accountName) {
+// boolean result = false;
+// if (accountName != null) {
+// Account[] ocAccounts = AccountManager.get(context).getAccountsByType(
+// MainApp.getAccountType());
+// boolean found = false;
+// for (Account account : ocAccounts) {
+// found = (account.name.equals(accountName));
+// if (found) {
+// SharedPreferences.Editor appPrefs = PreferenceManager
+// .getDefaultSharedPreferences(context).edit();
+// appPrefs.putString("select_oc_account", accountName);
+//
+// appPrefs.commit();
+// result = true;
+// break;
+// }
+// }
+// }
+// return result;
+// }
/**
*
return null;
}
- /**
- * Returns the proper URL path to access the WebDAV interface of an ownCloud server,
- * according to its version and the authorization method used.
- *
- * @param version Version of ownCloud server.
- * @param authTokenType Authorization token type, matching some of the AUTH_TOKEN_TYPE_* constants in {@link AccountAuthenticator}.
- * @return WebDAV path for given OC version and authorization method, null if OC version is unknown.
- */
- public static String getWebdavPath(OwnCloudVersion version, String authTokenType) {
- if (version != null) {
- if (MainApp.getAuthTokenTypeAccessToken().equals(authTokenType)) {
- return ODAV_PATH;
- }
- if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(authTokenType)) {
- return SAML_SSO_PATH;
- }
- if (version.compareTo(OwnCloudVersion.owncloud_v4) >= 0)
- return WEBDAV_PATH_4_0;
- if (version.compareTo(OwnCloudVersion.owncloud_v3) >= 0
- || version.compareTo(OwnCloudVersion.owncloud_v2) >= 0)
- return WEBDAV_PATH_2_0;
- if (version.compareTo(OwnCloudVersion.owncloud_v1) >= 0)
- return WEBDAV_PATH_1_2;
- }
- return null;
- }
+// /**
+// * Returns the proper URL path to access the WebDAV interface of an ownCloud server,
+// * according to its version and the authorization method used.
+// *
+// * @param version Version of ownCloud server.
+// * @param authTokenType Authorization token type, matching some of the AUTH_TOKEN_TYPE_* constants in {@link AccountAuthenticator}.
+// * @return WebDAV path for given OC version and authorization method, null if OC version is unknown.
+// */
+// public static String getWebdavPath(OwnCloudVersion version, String authTokenType) {
+// if (version != null) {
+// if (MainApp.getAuthTokenTypeAccessToken().equals(authTokenType)) {
+// return ODAV_PATH;
+// }
+// if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(authTokenType)) {
+// return SAML_SSO_PATH;
+// }
+// if (version.compareTo(OwnCloudVersion.owncloud_v4) >= 0)
+// return WEBDAV_PATH_4_0;
+// if (version.compareTo(OwnCloudVersion.owncloud_v3) >= 0
+// || version.compareTo(OwnCloudVersion.owncloud_v2) >= 0)
+// return WEBDAV_PATH_2_0;
+// if (version.compareTo(OwnCloudVersion.owncloud_v1) >= 0)
+// return WEBDAV_PATH_1_2;
+// }
+// return null;
+// }
/**
* Constructs full url to host and webdav resource basing on host version
-package com.owncloud.android.oc_framework.network;
/* ownCloud Android client application
* Copyright (C) 2012-2013 ownCloud Inc.
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+package com.owncloud.android.oc_framework.network;
import java.io.File;
import java.io.FileInputStream;
import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
import org.apache.http.conn.ssl.X509HostnameVerifier;
-import com.owncloud.android.oc_framework.MainApp;
import com.owncloud.android.oc_framework.authentication.AccountAuthenticatorConstants;
+import com.owncloud.android.oc_framework.authentication.AccountTypeUtils;
import com.owncloud.android.oc_framework.authentication.AccountUtils;
import com.owncloud.android.oc_framework.authentication.AccountUtils.AccountNotFoundException;
import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
+
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerFuture;
* @throws IOException If there was some I/O error while getting the authorization token for the account.
* @throws AccountNotFoundException If 'account' is unknown for the AccountManager
*/
- public static WebdavClient createOwnCloudClient (Account account, Context appContext) throws OperationCanceledException, AuthenticatorException, IOException, AccountNotFoundException {
+ public static WebdavClient createOwnCloudClient (Account account, Context appContext, String authorities) throws OperationCanceledException, AuthenticatorException, IOException, AccountNotFoundException {
//Log_OC.d(TAG, "Creating WebdavClient associated to " + account.name);
Uri uri = Uri.parse(AccountUtils.constructFullURLForAccount(appContext, account));
AccountManager am = AccountManager.get(appContext);
boolean isOauth2 = am.getUserData(account, AccountAuthenticatorConstants.KEY_SUPPORTS_OAUTH2) != null; // TODO avoid calling to getUserData here
boolean isSamlSso = am.getUserData(account, AccountAuthenticatorConstants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
- WebdavClient client = createOwnCloudClient(uri, appContext, !isSamlSso);
+ WebdavClient client = createOwnCloudClient(uri, appContext, !isSamlSso, authorities);
if (isOauth2) {
- String accessToken = am.blockingGetAuthToken(account, MainApp.getAuthTokenTypeAccessToken(), false);
- client.setBearerCredentials(accessToken); // TODO not assume that the access token is a bearer token
+ String accessToken = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypeAccessToken(account), false);
+ client.setBearerCredentials(accessToken, authorities); // TODO not assume that the access token is a bearer token
} else if (isSamlSso) { // TODO avoid a call to getUserData here
- String accessToken = am.blockingGetAuthToken(account, MainApp.getAuthTokenTypeSamlSessionCookie(), false);
- client.setSsoSessionCookie(accessToken);
+ String accessToken = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(account), false);
+ client.setSsoSessionCookie(accessToken, authorities);
} else {
String username = account.name.substring(0, account.name.lastIndexOf('@'));
//String password = am.getPassword(account);
- String password = am.blockingGetAuthToken(account, MainApp.getAuthTokenTypePass(), false);
- client.setBasicCredentials(username, password);
+ String password = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account), false);
+ client.setBasicCredentials(username, password, authorities);
}
return client;
}
- public static WebdavClient createOwnCloudClient (Account account, Context appContext, Activity currentActivity) throws OperationCanceledException, AuthenticatorException, IOException, AccountNotFoundException {
+ public static WebdavClient createOwnCloudClient (Account account, Context appContext, Activity currentActivity, String authorities) throws OperationCanceledException, AuthenticatorException, IOException, AccountNotFoundException {
Uri uri = Uri.parse(AccountUtils.constructFullURLForAccount(appContext, account));
AccountManager am = AccountManager.get(appContext);
boolean isOauth2 = am.getUserData(account, AccountAuthenticatorConstants.KEY_SUPPORTS_OAUTH2) != null; // TODO avoid calling to getUserData here
boolean isSamlSso = am.getUserData(account, AccountAuthenticatorConstants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
- WebdavClient client = createOwnCloudClient(uri, appContext, !isSamlSso);
+ WebdavClient client = createOwnCloudClient(uri, appContext, !isSamlSso, authorities);
if (isOauth2) { // TODO avoid a call to getUserData here
- AccountManagerFuture<Bundle> future = am.getAuthToken(account, MainApp.getAuthTokenTypeAccessToken(), null, currentActivity, null, null);
+ AccountManagerFuture<Bundle> future = am.getAuthToken(account, AccountTypeUtils.getAuthTokenTypeAccessToken(account), null, currentActivity, null, null);
Bundle result = future.getResult();
String accessToken = result.getString(AccountManager.KEY_AUTHTOKEN);
if (accessToken == null) throw new AuthenticatorException("WTF!");
- client.setBearerCredentials(accessToken); // TODO not assume that the access token is a bearer token
+ client.setBearerCredentials(accessToken, authorities); // TODO not assume that the access token is a bearer token
} else if (isSamlSso) { // TODO avoid a call to getUserData here
- AccountManagerFuture<Bundle> future = am.getAuthToken(account, MainApp.getAuthTokenTypeSamlSessionCookie(), null, currentActivity, null, null);
+ AccountManagerFuture<Bundle> future = am.getAuthToken(account, AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(account), null, currentActivity, null, null);
Bundle result = future.getResult();
String accessToken = result.getString(AccountManager.KEY_AUTHTOKEN);
if (accessToken == null) throw new AuthenticatorException("WTF!");
- client.setSsoSessionCookie(accessToken);
+ client.setSsoSessionCookie(accessToken, authorities);
} else {
String username = account.name.substring(0, account.name.lastIndexOf('@'));
//String password = am.getPassword(account);
//String password = am.blockingGetAuthToken(account, MainApp.getAuthTokenTypePass(), false);
- AccountManagerFuture<Bundle> future = am.getAuthToken(account, MainApp.getAuthTokenTypePass(), null, currentActivity, null, null);
+ AccountManagerFuture<Bundle> future = am.getAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account), null, currentActivity, null, null);
Bundle result = future.getResult();
String password = result.getString(AccountManager.KEY_AUTHTOKEN);
- client.setBasicCredentials(username, password);
+ client.setBasicCredentials(username, password, authorities);
}
return client;
* @param context Android context where the WebdavClient is being created.
* @return A WebdavClient object ready to be used
*/
- public static WebdavClient createOwnCloudClient(Uri uri, Context context, boolean followRedirects) {
+ public static WebdavClient createOwnCloudClient(Uri uri, Context context, boolean followRedirects, String authoritities) {
try {
registerAdvancedSslContext(true, context);
} catch (GeneralSecurityException e) {
Log.e(TAG, "The local server truststore could not be read. Default SSL management in the system will be used for HTTPS connections", e);
}
- WebdavClient client = new WebdavClient(getMultiThreadedConnManager());
+ WebdavClient client = new WebdavClient(getMultiThreadedConnManager(), authoritities);
client.setDefaultTimeouts(DEFAULT_DATA_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT);
client.setBaseUri(uri);
import org.apache.http.HttpStatus;
import org.apache.http.params.CoreProtocolPNames;
-import com.owncloud.android.oc_framework.MainApp;
import com.owncloud.android.oc_framework.network.BearerAuthScheme;
import com.owncloud.android.oc_framework.network.BearerCredentials;
/**
* Constructor
*/
- public WebdavClient(HttpConnectionManager connectionMgr) {
+ public WebdavClient(HttpConnectionManager connectionMgr, String authorities) {
super(connectionMgr);
Log.d(TAG, "Creating WebdavClient");
getParams().setParameter(HttpMethodParams.USER_AGENT, USER_AGENT);
getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
mFollowRedirects = true;
mSsoSessionCookie = null;
- mAuthTokenType = MainApp.getAuthTokenTypePass();
+ mAuthTokenType = authorities; // MainApp.getAuthTokenTypePass();
}
- public void setBearerCredentials(String accessToken) {
+ public void setBearerCredentials(String accessToken, String authorities) {
AuthPolicy.registerAuthScheme(BearerAuthScheme.AUTH_POLICY, BearerAuthScheme.class);
List<String> authPrefs = new ArrayList<String>(1);
mCredentials = new BearerCredentials(accessToken);
getState().setCredentials(AuthScope.ANY, mCredentials);
mSsoSessionCookie = null;
- mAuthTokenType = MainApp.getAuthTokenTypeAccessToken();
+ mAuthTokenType = authorities;// MainApp.getAuthTokenTypeAccessToken();
}
- public void setBasicCredentials(String username, String password) {
+ public void setBasicCredentials(String username, String password, String authorities) {
List<String> authPrefs = new ArrayList<String>(1);
authPrefs.add(AuthPolicy.BASIC);
getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
mCredentials = new UsernamePasswordCredentials(username, password);
getState().setCredentials(AuthScope.ANY, mCredentials);
mSsoSessionCookie = null;
- mAuthTokenType = MainApp.getAuthTokenTypePass();
+ mAuthTokenType = authorities; //MainApp.getAuthTokenTypePass();
}
- public void setSsoSessionCookie(String accessToken) {
+ public void setSsoSessionCookie(String accessToken, String authorities) {
getParams().setAuthenticationPreemptive(false);
getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
mSsoSessionCookie = accessToken;
mCredentials = null;
- mAuthTokenType = MainApp.getAuthTokenTypeSamlSessionCookie();
+ mAuthTokenType = authorities; //MainApp.getAuthTokenTypeSamlSessionCookie();
}
import org.apache.commons.httpclient.Credentials;
-import com.owncloud.android.oc_framework.MainApp;
import com.owncloud.android.oc_framework.network.BearerCredentials;
import com.owncloud.android.oc_framework.network.OwnCloudClientUtils;
import com.owncloud.android.oc_framework.network.webdav.WebdavClient;
/** ownCloud account in the remote ownCloud server to operate */
private Account mAccount = null;
+ /** Authoritities */
+ private String mAuthorities;
+
/** Android Application context */
private Context mContext = null;
* @param context Android context for the component calling the method.
* @return Result of the operation.
*/
- public final RemoteOperationResult execute(Account account, Context context) {
+ public final RemoteOperationResult execute(Account account, Context context, String authorities) {
if (account == null)
throw new IllegalArgumentException("Trying to execute a remote operation with a NULL Account");
if (context == null)
mAccount = account;
mContext = context.getApplicationContext();
try {
- mClient = OwnCloudClientUtils.createOwnCloudClient(mAccount, mContext);
+ mClient = OwnCloudClientUtils.createOwnCloudClient(mAccount, mContext, authorities);
} catch (Exception e) {
Log.e(TAG, "Error while trying to access to " + mAccount.name, e);
return new RemoteOperationResult(e);
}
+ mAuthorities = authorities;
return run(mClient);
}
if (mClient == null) {
if (mAccount != null && mContext != null) {
if (mCallerActivity != null) {
- mClient = OwnCloudClientUtils.createOwnCloudClient(mAccount, mContext, mCallerActivity);
+ mClient = OwnCloudClientUtils.createOwnCloudClient(mAccount, mContext, mCallerActivity, mAuthorities);
} else {
- mClient = OwnCloudClientUtils.createOwnCloudClient(mAccount, mContext);
+ mClient = OwnCloudClientUtils.createOwnCloudClient(mAccount, mContext, mAuthorities);
}
} else {
throw new IllegalStateException("Trying to run a remote operation asynchronously with no client instance or account");
boolean bearerAuthorization = (cred != null && cred instanceof BearerCredentials);
boolean samlBasedSsoAuthorization = (cred == null && ssoSessionCookie != null);
if (bearerAuthorization) {
- am.invalidateAuthToken(MainApp.getAccountType(), ((BearerCredentials)cred).getAccessToken());
+ am.invalidateAuthToken(mAccount.type, ((BearerCredentials)cred).getAccessToken());
} else if (samlBasedSsoAuthorization ) {
- am.invalidateAuthToken(MainApp.getAccountType(), ssoSessionCookie);
+ am.invalidateAuthToken(mAccount.type, ssoSessionCookie);
} else {
am.clearPassword(mAccount);
}