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

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: update baseurl, i hope 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
« no previous file with comments | « google_apis/gaia/gaia_auth_consumer.h ('k') | google_apis/gaia/gaia_auth_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 exchange the authorization code for an OAuthLogin-scoped 118 // Start a request to exchange the authorization code for an OAuthLogin-scoped
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // The format of the POST body for ClientLogin. 215 // The format of the POST body for ClientLogin.
210 static const char kClientLoginFormat[]; 216 static const char kClientLoginFormat[];
211 // The format of said POST body when CAPTCHA token & answer are specified. 217 // The format of said POST body when CAPTCHA token & answer are specified.
212 static const char kClientLoginCaptchaFormat[]; 218 static const char kClientLoginCaptchaFormat[];
213 // The format of the POST body for IssueAuthToken. 219 // The format of the POST body for IssueAuthToken.
214 static const char kIssueAuthTokenFormat[]; 220 static const char kIssueAuthTokenFormat[];
215 // The format of the POST body to get OAuth2 auth code from auth token. 221 // The format of the POST body to get OAuth2 auth code from auth token.
216 static const char kClientLoginToOAuth2BodyFormat[]; 222 static const char kClientLoginToOAuth2BodyFormat[];
217 // The format of the POST body to get OAuth2 token pair from auth code. 223 // The format of the POST body to get OAuth2 token pair from auth code.
218 static const char kOAuth2CodeToTokenPairBodyFormat[]; 224 static const char kOAuth2CodeToTokenPairBodyFormat[];
225 // The format of the POST body to revoke an OAuth2 token.
226 static const char kOAuth2RevokeTokenBodyFormat[];
219 // The format of the POST body for GetUserInfo. 227 // The format of the POST body for GetUserInfo.
220 static const char kGetUserInfoFormat[]; 228 static const char kGetUserInfoFormat[];
221 // The format of the POST body for MergeSession. 229 // The format of the POST body for MergeSession.
222 static const char kMergeSessionFormat[]; 230 static const char kMergeSessionFormat[];
223 // The format of the URL for UberAuthToken. 231 // The format of the URL for UberAuthToken.
224 static const char kUberAuthTokenURLFormat[]; 232 static const char kUberAuthTokenURLFormat[];
225 // The format of the body for OAuthLogin. 233 // The format of the body for OAuthLogin.
226 static const char kOAuthLoginFormat[]; 234 static const char kOAuthLoginFormat[];
227 235
228 // Constants for parsing ClientLogin errors. 236 // Constants for parsing ClientLogin errors.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 274
267 void OnClientLoginToOAuth2Fetched(const std::string& data, 275 void OnClientLoginToOAuth2Fetched(const std::string& data,
268 const net::ResponseCookies& cookies, 276 const net::ResponseCookies& cookies,
269 const net::URLRequestStatus& status, 277 const net::URLRequestStatus& status,
270 int response_code); 278 int response_code);
271 279
272 void OnOAuth2TokenPairFetched(const std::string& data, 280 void OnOAuth2TokenPairFetched(const std::string& data,
273 const net::URLRequestStatus& status, 281 const net::URLRequestStatus& status,
274 int response_code); 282 int response_code);
275 283
284 void OnOAuth2RevokeTokenFetched(const std::string& data,
285 const net::URLRequestStatus& status,
286 int response_code);
287
276 void OnGetUserInfoFetched(const std::string& data, 288 void OnGetUserInfoFetched(const std::string& data,
277 const net::URLRequestStatus& status, 289 const net::URLRequestStatus& status,
278 int response_code); 290 int response_code);
279 291
280 void OnMergeSessionFetched(const std::string& data, 292 void OnMergeSessionFetched(const std::string& data,
281 const net::URLRequestStatus& status, 293 const net::URLRequestStatus& status,
282 int response_code); 294 int response_code);
283 295
284 void OnUberAuthTokenFetch(const std::string& data, 296 void OnUberAuthTokenFetch(const std::string& data,
285 const net::URLRequestStatus& status, 297 const net::URLRequestStatus& status,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 HostedAccountsSetting allow_hosted_accounts); 343 HostedAccountsSetting allow_hosted_accounts);
332 // Supply the sid / lsid returned from ClientLogin in order to 344 // Supply the sid / lsid returned from ClientLogin in order to
333 // request a long lived auth token for a service. 345 // request a long lived auth token for a service.
334 static std::string MakeIssueAuthTokenBody(const std::string& sid, 346 static std::string MakeIssueAuthTokenBody(const std::string& sid,
335 const std::string& lsid, 347 const std::string& lsid,
336 const char* const service); 348 const char* const service);
337 // Create body to get OAuth2 auth code. 349 // Create body to get OAuth2 auth code.
338 static std::string MakeGetAuthCodeBody(); 350 static std::string MakeGetAuthCodeBody();
339 // Given auth code, create body to get OAuth2 token pair. 351 // Given auth code, create body to get OAuth2 token pair.
340 static std::string MakeGetTokenPairBody(const std::string& auth_code); 352 static std::string MakeGetTokenPairBody(const std::string& auth_code);
353 // Given an OAuth2 token, create body to revoke the token.
354 std::string MakeRevokeTokenBody(const std::string& auth_token);
341 // Supply the lsid returned from ClientLogin in order to fetch 355 // Supply the lsid returned from ClientLogin in order to fetch
342 // user information. 356 // user information.
343 static std::string MakeGetUserInfoBody(const std::string& lsid); 357 static std::string MakeGetUserInfoBody(const std::string& lsid);
344 358
345 // Supply the authentication token returned from StartIssueAuthToken. 359 // Supply the authentication token returned from StartIssueAuthToken.
346 static std::string MakeMergeSessionBody(const std::string& auth_token, 360 static std::string MakeMergeSessionBody(const std::string& auth_token,
347 const std::string& continue_url, 361 const std::string& continue_url,
348 const std::string& source); 362 const std::string& source);
349 363
350 static std::string MakeGetAuthCodeHeader(const std::string& auth_token); 364 static std::string MakeGetAuthCodeHeader(const std::string& auth_token);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 const std::string& data, 399 const std::string& data,
386 const net::URLRequestStatus& status); 400 const net::URLRequestStatus& status);
387 401
388 // These fields are common to GaiaAuthFetcher, same every request 402 // These fields are common to GaiaAuthFetcher, same every request
389 GaiaAuthConsumer* const consumer_; 403 GaiaAuthConsumer* const consumer_;
390 net::URLRequestContextGetter* const getter_; 404 net::URLRequestContextGetter* const getter_;
391 std::string source_; 405 std::string source_;
392 const GURL client_login_gurl_; 406 const GURL client_login_gurl_;
393 const GURL issue_auth_token_gurl_; 407 const GURL issue_auth_token_gurl_;
394 const GURL oauth2_token_gurl_; 408 const GURL oauth2_token_gurl_;
409 const GURL oauth2_revoke_gurl_;
395 const GURL get_user_info_gurl_; 410 const GURL get_user_info_gurl_;
396 const GURL merge_session_gurl_; 411 const GURL merge_session_gurl_;
397 const GURL uberauth_token_gurl_; 412 const GURL uberauth_token_gurl_;
398 const GURL client_oauth_gurl_; 413 const GURL client_oauth_gurl_;
399 const GURL oauth_login_gurl_; 414 const GURL oauth_login_gurl_;
400 415
401 // While a fetch is going on: 416 // While a fetch is going on:
402 scoped_ptr<net::URLFetcher> fetcher_; 417 scoped_ptr<net::URLFetcher> fetcher_;
403 GURL client_login_to_oauth2_gurl_; 418 GURL client_login_to_oauth2_gurl_;
404 std::string request_body_; 419 std::string request_body_;
(...skipping 15 matching lines...) Expand all
420 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); 435 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse);
421 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); 436 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess);
422 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); 437 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote);
423 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); 438 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess);
424 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); 439 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote);
425 440
426 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); 441 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher);
427 }; 442 };
428 443
429 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ 444 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_
OLDNEW
« no previous file with comments | « google_apis/gaia/gaia_auth_consumer.h ('k') | google_apis/gaia/gaia_auth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698