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

Side by Side Diff: google_apis/gaia/gaia_auth_fetcher.h

Issue 13249007: revoke unused OAuth2 tokens on signout (Closed) Base URL: /home/courage/git/chromium-src.git/@222774-invalid-grant-relogin
Patch Set: Created 7 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ 5 #ifndef GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_
6 #define GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ 6 #define GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void StartIssueAuthTokenForOAuth2(const std::string& oauth2_access_token, 93 void StartIssueAuthTokenForOAuth2(const std::string& oauth2_access_token,
94 const char* const service); 94 const char* const service);
95 95
96 // Start a request to exchange an "lso" service token given by |auth_token| 96 // Start a request to exchange an "lso" service token given by |auth_token|
97 // for an OAuthLogin-scoped oauth2 token. 97 // for an OAuthLogin-scoped oauth2 token.
98 // 98 //
99 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be 99 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be
100 // called on the consumer on the original thread. 100 // called on the consumer on the original thread.
101 void StartLsoForOAuthLoginTokenExchange(const std::string& auth_token); 101 void StartLsoForOAuthLoginTokenExchange(const std::string& auth_token);
102 102
103 // Start a request to revoke |auth_token|.
104 //
105 // Either OnRevokeOAuth2TokenSuccess or OnRevokeOAuth2TokenSuccess will be
106 // called on the consumer on the original thread.
107 void StartRevokeOAuth2Token(const std::string& auth_token);
108
103 // Start a request to exchange the cookies of a signed-in user session 109 // Start a request to exchange the cookies of a signed-in user session
104 // for an OAuthLogin-scoped oauth2 token. In the case of a session with 110 // for an OAuthLogin-scoped oauth2 token. In the case of a session with
105 // multiple accounts signed in, |session_index| indicate the which of accounts 111 // multiple accounts signed in, |session_index| indicate the which of accounts
106 // within the session. 112 // within the session.
107 // 113 //
108 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be 114 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be
109 // called on the consumer on the original thread. 115 // called on the consumer on the original thread.
110 void StartCookieForOAuthLoginTokenExchange(const std::string& session_index); 116 void StartCookieForOAuthLoginTokenExchange(const std::string& session_index);
111 117
112 // Start a request to get user info for the account identified by |lsid|. 118 // Start a request to get user info for the account identified by |lsid|.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // The format of the POST body for ClientLogin. 208 // The format of the POST body for ClientLogin.
203 static const char kClientLoginFormat[]; 209 static const char kClientLoginFormat[];
204 // The format of said POST body when CAPTCHA token & answer are specified. 210 // The format of said POST body when CAPTCHA token & answer are specified.
205 static const char kClientLoginCaptchaFormat[]; 211 static const char kClientLoginCaptchaFormat[];
206 // The format of the POST body for IssueAuthToken. 212 // The format of the POST body for IssueAuthToken.
207 static const char kIssueAuthTokenFormat[]; 213 static const char kIssueAuthTokenFormat[];
208 // The format of the POST body to get OAuth2 auth code from auth token. 214 // The format of the POST body to get OAuth2 auth code from auth token.
209 static const char kClientLoginToOAuth2BodyFormat[]; 215 static const char kClientLoginToOAuth2BodyFormat[];
210 // The format of the POST body to get OAuth2 token pair from auth code. 216 // The format of the POST body to get OAuth2 token pair from auth code.
211 static const char kOAuth2CodeToTokenPairBodyFormat[]; 217 static const char kOAuth2CodeToTokenPairBodyFormat[];
218 // The format of the POST body to revoke an OAuth2 token.
219 static const char kOAuth2RevokeTokenBodyFormat[];
212 // The format of the POST body for GetUserInfo. 220 // The format of the POST body for GetUserInfo.
213 static const char kGetUserInfoFormat[]; 221 static const char kGetUserInfoFormat[];
214 // The format of the POST body for MergeSession. 222 // The format of the POST body for MergeSession.
215 static const char kMergeSessionFormat[]; 223 static const char kMergeSessionFormat[];
216 // The format of the URL for UberAuthToken. 224 // The format of the URL for UberAuthToken.
217 static const char kUberAuthTokenURLFormat[]; 225 static const char kUberAuthTokenURLFormat[];
218 // The format of the body for OAuthLogin. 226 // The format of the body for OAuthLogin.
219 static const char kOAuthLoginFormat[]; 227 static const char kOAuthLoginFormat[];
220 228
221 // Constants for parsing ClientLogin errors. 229 // Constants for parsing ClientLogin errors.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 267
260 void OnClientLoginToOAuth2Fetched(const std::string& data, 268 void OnClientLoginToOAuth2Fetched(const std::string& data,
261 const net::ResponseCookies& cookies, 269 const net::ResponseCookies& cookies,
262 const net::URLRequestStatus& status, 270 const net::URLRequestStatus& status,
263 int response_code); 271 int response_code);
264 272
265 void OnOAuth2TokenPairFetched(const std::string& data, 273 void OnOAuth2TokenPairFetched(const std::string& data,
266 const net::URLRequestStatus& status, 274 const net::URLRequestStatus& status,
267 int response_code); 275 int response_code);
268 276
277 void OnOAuth2RevokeTokenFetched(const std::string& data,
278 const net::URLRequestStatus& status,
279 int response_code);
280
269 void OnGetUserInfoFetched(const std::string& data, 281 void OnGetUserInfoFetched(const std::string& data,
270 const net::URLRequestStatus& status, 282 const net::URLRequestStatus& status,
271 int response_code); 283 int response_code);
272 284
273 void OnMergeSessionFetched(const std::string& data, 285 void OnMergeSessionFetched(const std::string& data,
274 const net::URLRequestStatus& status, 286 const net::URLRequestStatus& status,
275 int response_code); 287 int response_code);
276 288
277 void OnUberAuthTokenFetch(const std::string& data, 289 void OnUberAuthTokenFetch(const std::string& data,
278 const net::URLRequestStatus& status, 290 const net::URLRequestStatus& status,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 HostedAccountsSetting allow_hosted_accounts); 336 HostedAccountsSetting allow_hosted_accounts);
325 // Supply the sid / lsid returned from ClientLogin in order to 337 // Supply the sid / lsid returned from ClientLogin in order to
326 // request a long lived auth token for a service. 338 // request a long lived auth token for a service.
327 static std::string MakeIssueAuthTokenBody(const std::string& sid, 339 static std::string MakeIssueAuthTokenBody(const std::string& sid,
328 const std::string& lsid, 340 const std::string& lsid,
329 const char* const service); 341 const char* const service);
330 // Create body to get OAuth2 auth code. 342 // Create body to get OAuth2 auth code.
331 static std::string MakeGetAuthCodeBody(); 343 static std::string MakeGetAuthCodeBody();
332 // Given auth code, create body to get OAuth2 token pair. 344 // Given auth code, create body to get OAuth2 token pair.
333 static std::string MakeGetTokenPairBody(const std::string& auth_code); 345 static std::string MakeGetTokenPairBody(const std::string& auth_code);
346 // Given an OAuth2 token, create body to revoke the token.
347 std::string MakeRevokeTokenBody(const std::string& auth_token);
334 // Supply the lsid returned from ClientLogin in order to fetch 348 // Supply the lsid returned from ClientLogin in order to fetch
335 // user information. 349 // user information.
336 static std::string MakeGetUserInfoBody(const std::string& lsid); 350 static std::string MakeGetUserInfoBody(const std::string& lsid);
337 351
338 // Supply the authentication token returned from StartIssueAuthToken. 352 // Supply the authentication token returned from StartIssueAuthToken.
339 static std::string MakeMergeSessionBody(const std::string& auth_token, 353 static std::string MakeMergeSessionBody(const std::string& auth_token,
340 const std::string& continue_url, 354 const std::string& continue_url,
341 const std::string& source); 355 const std::string& source);
342 356
343 static std::string MakeGetAuthCodeHeader(const std::string& auth_token); 357 static std::string MakeGetAuthCodeHeader(const std::string& auth_token);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 const std::string& data, 394 const std::string& data,
381 const net::URLRequestStatus& status); 395 const net::URLRequestStatus& status);
382 396
383 // These fields are common to GaiaAuthFetcher, same every request 397 // These fields are common to GaiaAuthFetcher, same every request
384 GaiaAuthConsumer* const consumer_; 398 GaiaAuthConsumer* const consumer_;
385 net::URLRequestContextGetter* const getter_; 399 net::URLRequestContextGetter* const getter_;
386 std::string source_; 400 std::string source_;
387 const GURL client_login_gurl_; 401 const GURL client_login_gurl_;
388 const GURL issue_auth_token_gurl_; 402 const GURL issue_auth_token_gurl_;
389 const GURL oauth2_token_gurl_; 403 const GURL oauth2_token_gurl_;
404 const GURL oauth2_revoke_gurl_;
390 const GURL get_user_info_gurl_; 405 const GURL get_user_info_gurl_;
391 const GURL merge_session_gurl_; 406 const GURL merge_session_gurl_;
392 const GURL uberauth_token_gurl_; 407 const GURL uberauth_token_gurl_;
393 const GURL client_oauth_gurl_; 408 const GURL client_oauth_gurl_;
394 const GURL oauth_login_gurl_; 409 const GURL oauth_login_gurl_;
395 410
396 // While a fetch is going on: 411 // While a fetch is going on:
397 scoped_ptr<net::URLFetcher> fetcher_; 412 scoped_ptr<net::URLFetcher> fetcher_;
398 GURL client_login_to_oauth2_gurl_; 413 GURL client_login_to_oauth2_gurl_;
399 std::string request_body_; 414 std::string request_body_;
(...skipping 15 matching lines...) Expand all
415 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); 430 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse);
416 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); 431 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess);
417 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); 432 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote);
418 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); 433 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess);
419 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); 434 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote);
420 435
421 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); 436 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher);
422 }; 437 };
423 438
424 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ 439 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698