diff --git a/google_apis/gaia/oauth2_access_token_manager.cc b/google_apis/gaia/oauth2_access_token_manager.cc index 4527a811ff8d89..4322d541a02785 100644 --- a/google_apis/gaia/oauth2_access_token_manager.cc +++ b/google_apis/gaia/oauth2_access_token_manager.cc @@ -493,6 +493,19 @@ void OAuth2AccessTokenManager::CancelRequestsForAccount( CancelFetchers(fetchers_to_cancel); } +void OAuth2AccessTokenManager::InvalidateAccessToken( + const CoreAccountId& account_id, + const OAuth2TokenService::ScopeSet& scopes, + const std::string& access_token) { + // TODO(https://crbug.com/967598): Use directly + // OAuth2AccessTokenManager::InvalidateAccessTokenImpl once this fully manages + // access tokens independently of OAuth2TokenService. For now, some tests need + // to call overridden of OAuth2TokenService::InvalidateAccessTokenImpl. + token_service_->InvalidateAccessTokenImpl( + account_id, GaiaUrls::GetInstance()->oauth2_chrome_client_id(), scopes, + access_token); +} + void OAuth2AccessTokenManager::InvalidateAccessTokenImpl( const CoreAccountId& account_id, const std::string& client_id, diff --git a/google_apis/gaia/oauth2_access_token_manager.h b/google_apis/gaia/oauth2_access_token_manager.h index 979552c8775233..3277a094ca4282 100644 --- a/google_apis/gaia/oauth2_access_token_manager.h +++ b/google_apis/gaia/oauth2_access_token_manager.h @@ -120,6 +120,15 @@ class OAuth2AccessTokenManager { // Cancels all requests related to a given |account_id|. void CancelRequestsForAccount(const CoreAccountId& account_id); + // Mark an OAuth2 |access_token| issued for |account_id| and |scopes| as + // invalid. This should be done if the token was received from this class, + // but was not accepted by the server (e.g., the server returned + // 401 Unauthorized). The token will be removed from the cache for the given + // scopes. + void InvalidateAccessToken(const CoreAccountId& account_id, + const OAuth2TokenService::ScopeSet& scopes, + const std::string& access_token); + // Invalidates the |access_token| issued for |account_id|, |client_id| and // |scopes|. void InvalidateAccessTokenImpl(const CoreAccountId& account_id, diff --git a/google_apis/gaia/oauth2_token_service.cc b/google_apis/gaia/oauth2_token_service.cc index fe09aa8d0388eb..9dcf875264e24a 100644 --- a/google_apis/gaia/oauth2_token_service.cc +++ b/google_apis/gaia/oauth2_token_service.cc @@ -214,9 +214,7 @@ void OAuth2TokenService::InvalidateAccessToken( const CoreAccountId& account_id, const ScopeSet& scopes, const std::string& access_token) { - InvalidateAccessTokenImpl(account_id, - GaiaUrls::GetInstance()->oauth2_chrome_client_id(), - scopes, access_token); + token_manager_->InvalidateAccessToken(account_id, scopes, access_token); } void OAuth2TokenService::InvalidateTokenForMultilogin( @@ -232,14 +230,6 @@ void OAuth2TokenService::InvalidateTokenForMultilogin( delegate_->InvalidateTokenForMultilogin(failed_account); } -void OAuth2TokenService::InvalidateAccessTokenForClient( - const CoreAccountId& account_id, - const std::string& client_id, - const ScopeSet& scopes, - const std::string& access_token) { - InvalidateAccessTokenImpl(account_id, client_id, scopes, access_token); -} - void OAuth2TokenService::InvalidateAccessTokenImpl( const CoreAccountId& account_id, const std::string& client_id, diff --git a/google_apis/gaia/oauth2_token_service.h b/google_apis/gaia/oauth2_token_service.h index 74e8571cf4225c..5553635ec370d1 100644 --- a/google_apis/gaia/oauth2_token_service.h +++ b/google_apis/gaia/oauth2_token_service.h @@ -180,17 +180,11 @@ class OAuth2TokenService : public OAuth2TokenServiceObserver { // but was not accepted by the server (e.g., the server returned // 401 Unauthorized). The token will be removed from the cache for the given // scopes. + // Deprecated. It's moved to OAuth2AccessTokenManager. void InvalidateAccessToken(const CoreAccountId& account_id, const ScopeSet& scopes, const std::string& access_token); - // Like |InvalidateToken| except is uses |client_id| to identity OAuth2 client - // app that issued the request instead of Chrome's default values. - void InvalidateAccessTokenForClient(const CoreAccountId& account_id, - const std::string& client_id, - const ScopeSet& scopes, - const std::string& access_token); - // Removes token from cache (if it is cached) and calls // InvalidateTokenForMultilogin method of the delegate. This should be done if // the token was received from this class, but was not accepted by the server