Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: chrome/browser/signin/signin_manager.cc

Issue 13249007: revoke unused OAuth2 tokens on signout (Closed) Base URL: /home/courage/git/chromium-src.git/@222774-invalid-grant-relogin
Patch Set: update baseurl, i hope Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/signin/signin_manager.h ('k') | google_apis/gaia/gaia_auth_consumer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/signin_manager.cc
diff --git a/chrome/browser/signin/signin_manager.cc b/chrome/browser/signin/signin_manager.cc
index 18a41dfd68bc512be87a0316bceef751cc661da5..a8bc0819236676b11e3c04a912e79461d105ce5e 100644
--- a/chrome/browser/signin/signin_manager.cc
+++ b/chrome/browser/signin/signin_manager.cc
@@ -328,6 +328,7 @@ bool SigninManager::PrepareForSignin(SigninType type,
// need to try again, but take care to leave state around tracking that the
// user has successfully signed in once before with this username, so that on
// restart we don't think sync setup has never completed.
+ RevokeOAuthLoginToken();
ClearTransientSigninData();
type_ = type;
possibly_invalid_username_.assign(username);
@@ -558,10 +559,27 @@ void SigninManager::SignOut() {
chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
content::Source<Profile>(profile_),
content::Details<const GoogleServiceSignoutDetails>(&details));
+ RevokeOAuthLoginToken();
token_service->ResetCredentialsInMemory();
token_service->EraseTokensFromDB();
}
+void SigninManager::RevokeOAuthLoginToken() {
+ TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
+ if (token_service->HasOAuthLoginToken()) {
+ revoke_token_fetcher_.reset(
+ new GaiaAuthFetcher(this,
+ GaiaConstants::kChromeSource,
+ profile_->GetRequestContext()));
+ revoke_token_fetcher_->StartRevokeOAuth2Token(
+ token_service->GetOAuth2LoginRefreshToken());
+ }
+}
+
+void SigninManager::OnOAuth2RevokeTokenCompleted() {
+ revoke_token_fetcher_.reset(NULL);
+}
+
bool SigninManager::AuthInProgress() const {
return !possibly_invalid_username_.empty();
}
« no previous file with comments | « chrome/browser/signin/signin_manager.h ('k') | google_apis/gaia/gaia_auth_consumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698