| Index: google_apis/gaia/gaia_auth_fetcher.cc
|
| diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc
|
| index 822fc98ab9f7d3a5c86a9698e084e3f66a4b714f..7a16cb8605d37a8ee6fae5b2bce3933135cb7663 100644
|
| --- a/google_apis/gaia/gaia_auth_fetcher.cc
|
| +++ b/google_apis/gaia/gaia_auth_fetcher.cc
|
| @@ -91,6 +91,9 @@ const char GaiaAuthFetcher::kOAuth2CodeToTokenPairBodyFormat[] =
|
| "client_secret=%s&"
|
| "code=%s";
|
| // static
|
| +const char GaiaAuthFetcher::kOAuth2RevokeTokenBodyFormat[] =
|
| + "token=%s";
|
| +// static
|
| const char GaiaAuthFetcher::kGetUserInfoFormat[] =
|
| "LSID=%s";
|
| // static
|
| @@ -180,6 +183,7 @@ GaiaAuthFetcher::GaiaAuthFetcher(GaiaAuthConsumer* consumer,
|
| client_login_gurl_(GaiaUrls::GetInstance()->client_login_url()),
|
| issue_auth_token_gurl_(GaiaUrls::GetInstance()->issue_auth_token_url()),
|
| oauth2_token_gurl_(GaiaUrls::GetInstance()->oauth2_token_url()),
|
| + oauth2_revoke_gurl_(GaiaUrls::GetInstance()->oauth2_revoke_url()),
|
| get_user_info_gurl_(GaiaUrls::GetInstance()->get_user_info_url()),
|
| merge_session_gurl_(GaiaUrls::GetInstance()->merge_session_url()),
|
| uberauth_token_gurl_(base::StringPrintf(kUberAuthTokenURLFormat,
|
| @@ -329,6 +333,12 @@ std::string GaiaAuthFetcher::MakeGetTokenPairBody(
|
| }
|
|
|
| // static
|
| +std::string GaiaAuthFetcher::MakeRevokeTokenBody(
|
| + const std::string& auth_token) {
|
| + return base::StringPrintf(kOAuth2RevokeTokenBodyFormat, auth_token.c_str());
|
| +}
|
| +
|
| +// static
|
| std::string GaiaAuthFetcher::MakeGetUserInfoBody(const std::string& lsid) {
|
| std::string encoded_lsid = net::EscapeUrlEncodedData(lsid, true);
|
| return base::StringPrintf(kGetUserInfoFormat, encoded_lsid.c_str());
|
| @@ -652,6 +662,21 @@ void GaiaAuthFetcher::StartLsoForOAuthLoginTokenExchange(
|
| fetcher_->Start();
|
| }
|
|
|
| +void GaiaAuthFetcher::StartRevokeOAuth2Token(const std::string& auth_token) {
|
| + DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
|
| +
|
| + DVLOG(1) << "Starting OAuth2 token revocation";
|
| + request_body_ = MakeRevokeTokenBody(auth_token);
|
| + fetcher_.reset(CreateGaiaFetcher(getter_,
|
| + request_body_,
|
| + "",
|
| + oauth2_revoke_gurl_,
|
| + kLoadFlagsIgnoreCookies,
|
| + this));
|
| + fetch_pending_ = true;
|
| + fetcher_->Start();
|
| +}
|
| +
|
| void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchange(
|
| const std::string& session_index) {
|
| DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
|
| @@ -990,6 +1015,13 @@ void GaiaAuthFetcher::OnOAuth2TokenPairFetched(
|
| }
|
| }
|
|
|
| +void GaiaAuthFetcher::OnOAuth2RevokeTokenFetched(
|
| + const std::string& data,
|
| + const net::URLRequestStatus& status,
|
| + int response_code) {
|
| + consumer_->OnOAuth2RevokeTokenCompleted();
|
| +}
|
| +
|
| void GaiaAuthFetcher::OnGetUserInfoFetched(
|
| const std::string& data,
|
| const net::URLRequestStatus& status,
|
| @@ -1118,6 +1150,8 @@ void GaiaAuthFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
|
| OnClientOAuthFetched(data, status, response_code);
|
| } else if (url == oauth_login_gurl_) {
|
| OnOAuthLoginFetched(data, status, response_code);
|
| + } else if (url == oauth2_revoke_gurl_) {
|
| + OnOAuth2RevokeTokenFetched(data, status, response_code);
|
| } else {
|
| NOTREACHED();
|
| }
|
|
|