OLD | NEW |
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Start a request to exchange the cookies of a signed-in user session | 103 // 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 | 104 // 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 | 105 // multiple accounts signed in, |session_index| indicate the which of accounts |
106 // within the session. | 106 // within the session. |
107 // | 107 // |
108 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be | 108 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be |
109 // called on the consumer on the original thread. | 109 // called on the consumer on the original thread. |
110 void StartCookieForOAuthLoginTokenExchange(const std::string& session_index); | 110 void StartCookieForOAuthLoginTokenExchange(const std::string& session_index); |
111 | 111 |
| 112 // Start a request to exchange the authorization code for an OAuthLogin-scoped |
| 113 // oauth2 token. |
| 114 // |
| 115 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be |
| 116 // called on the consumer on the original thread. |
| 117 void StartAuthCodeForOAuth2TokenExchange(const std::string& auth_code); |
| 118 |
112 // Start a request to get user info for the account identified by |lsid|. | 119 // Start a request to get user info for the account identified by |lsid|. |
113 // | 120 // |
114 // Either OnGetUserInfoSuccess or OnGetUserInfoFailure will be | 121 // Either OnGetUserInfoSuccess or OnGetUserInfoFailure will be |
115 // called on the consumer on the original thread. | 122 // called on the consumer on the original thread. |
116 void StartGetUserInfo(const std::string& lsid); | 123 void StartGetUserInfo(const std::string& lsid); |
117 | 124 |
118 // Start a MergeSession request to pre-login the user with the given | 125 // Start a MergeSession request to pre-login the user with the given |
119 // credentials. | 126 // credentials. |
120 // | 127 // |
121 // Start a MergeSession request to fill the browsing cookie jar with | 128 // Start a MergeSession request to fill the browsing cookie jar with |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 const std::string& locale); | 357 const std::string& locale); |
351 | 358 |
352 static std::string MakeClientOAuthChallengeResponseBody( | 359 static std::string MakeClientOAuthChallengeResponseBody( |
353 const std::string& name, | 360 const std::string& name, |
354 const std::string& token, | 361 const std::string& token, |
355 const std::string& solution); | 362 const std::string& solution); |
356 | 363 |
357 static std::string MakeOAuthLoginBody(const std::string& service, | 364 static std::string MakeOAuthLoginBody(const std::string& service, |
358 const std::string& source); | 365 const std::string& source); |
359 | 366 |
360 void StartOAuth2TokenPairFetch(const std::string& auth_code); | |
361 | |
362 // Create a fetcher usable for making any Gaia request. |body| is used | 367 // Create a fetcher usable for making any Gaia request. |body| is used |
363 // as the body of the POST request sent to GAIA. Any strings listed in | 368 // as the body of the POST request sent to GAIA. Any strings listed in |
364 // |headers| are added as extra HTTP headers in the request. | 369 // |headers| are added as extra HTTP headers in the request. |
365 // | 370 // |
366 // |load_flags| are passed to directly to net::URLFetcher::Create() when | 371 // |load_flags| are passed to directly to net::URLFetcher::Create() when |
367 // creating the URL fetcher. | 372 // creating the URL fetcher. |
368 static net::URLFetcher* CreateGaiaFetcher( | 373 static net::URLFetcher* CreateGaiaFetcher( |
369 net::URLRequestContextGetter* getter, | 374 net::URLRequestContextGetter* getter, |
370 const std::string& body, | 375 const std::string& body, |
371 const std::string& headers, | 376 const std::string& headers, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 420 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
416 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 421 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
417 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 422 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
418 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 423 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
419 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 424 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
420 | 425 |
421 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 426 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
422 }; | 427 }; |
423 | 428 |
424 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 429 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
OLD | NEW |