我想知道这里是否存在安全问题?任何使用谷歌智能锁的应用程序都会知道用户的谷歌、推特等帐户凭据吗?在此处查看此 google 教程,在 credentialsRetrieved 回调中,Credential 对象具有应用程序可以访问的用户用户名和密码。但现在该应用知道用户的 google 或 twitter 帐户了吗?这是我正在谈论的代码:
private void onCredentialRetrieved(Credential credential) {
String accountType = credential.getAccountType();
if (accountType == null) {
// Sign the user in with information from the Credential.
//right here we have the users login credentials, dont we ?? There exposed.
signInWithPassword(credential.getId(), credential.getPassword());
} else if (accountType.equals(IdentityProviders.GOOGLE)) {
// The user has previously signed in with Google Sign-In. Silently
// sign in the user with the same ID.
// See https://developers.google.com/identity/sign-in/android/
GoogleSignInOptions gso =
new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.setAccountName(credential.getId())
.build();
OptionalPendingResult<GoogleSignInResult> opr =
Auth.GoogleSignInApi.silentSignIn(mGoogleApiClient);
// ...
}
}
所以我在这里看到的是 Credentials 对象可以公开用户密码。我意识到继续登录过程需要凭据,但这是用户在打开智能锁时做出的选择吗?
更糟糕的情况:假设用户启用了智能锁,我制作了一个使用智能锁的应用程序。现在我可以访问用户的 Twitter 帐户凭据并做一些恶意的事情。如何保护用户?