0

似乎没有人遇到过这个问题或不谈论它。我为企业应用程序实现了身份验证器“概念”。并且以随机方式,当我导航到帐户设置时,而不是左侧菜单中的帐户名,我可以以明文形式看到密码!这很奇怪,我实际上无法解释!正如你在这里看到的:

带有明文密码的帐户设置

[更新] 我使用的一些 API:

accountManager.addAccount(AuthenticationActivity.ACCOUNT_TYPE, 
    SaurAuthenticator.AUTH_TOKEN_TYPE, 
    null, null, activity, 
    new OnCreatedAccount(activity, accountManager, handler),
    null);

OnCreatedAccount 运行这个

Bundle bundle = future.getResult();
String accountName = bundle.getString(AccountManager.KEY_ACCOUNT_NAME);
String accountType = bundle.getString(AccountManager.KEY_ACCOUNT_TYPE);
Log.v(tag, "account created : " + accountName + " - " + accountType);
Account currentAccount = new Account(accountName, accountType);
Log.v(tag, "ask token ");
mAccountManager.getAuthToken(currentAccount, SaurAuthenticator.AUTH_TOKEN_TYPE,
    null, mActivity, new OnTokenAcquired(mHandler), null);

我的 AuthenticationActivity (显示登录名和密码TextView)我有一个方法 finishLogin :

String accountName = intent.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);

final Account account = new Account(accountName, intent.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE));

if (getIntent().getBooleanExtra(ARG_IS_ADDING_NEW_ACCOUNT, false)) {
    String authtoken = intent.getStringExtra(AccountManager.KEY_AUTHTOKEN);
    // Creating the account on the device and setting the auth token we got
    manager.addAccountExplicitly(account, null, null);
    // If do not call setAuthToken cause other unnecessary server call
    manager.setAuthToken(account, SaurAuthenticator.AUTH_TOKEN_TYPE, authtoken);
    // Force auto sync for this account 
    ContentResolver.setSyncAutomatically(account, DataCacheContract.AUTHORITY, true);
}

  setAccountAuthenticatorResult(intent.getExtras());
  setResult(RESULT_OK, intent);

我希望我的英语是正确的:)

感谢您的帮助!

4

0 回答 0