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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // within the session. | 97 // within the session. |
98 // Resulting refresh token is annotated on the server with |device_id|. Format | 98 // Resulting refresh token is annotated on the server with |device_id|. Format |
99 // of device_id on the server is at most 64 unicode characters. | 99 // of device_id on the server is at most 64 unicode characters. |
100 // | 100 // |
101 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be | 101 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be |
102 // called on the consumer on the original thread. | 102 // called on the consumer on the original thread. |
103 void StartCookieForOAuthLoginTokenExchangeWithDeviceId( | 103 void StartCookieForOAuthLoginTokenExchangeWithDeviceId( |
104 const std::string& session_index, | 104 const std::string& session_index, |
105 const std::string& device_id); | 105 const std::string& device_id); |
106 | 106 |
| 107 // Start a request to exchange the cookies of a signed-in user session |
| 108 // and for specified client for an OAuthLogin-scoped oauth2 token. Client is |
| 109 // determined by its |client_id|. In the case of a session with multiple |
| 110 // accounts signed in, |session_index| indicate the which of accounts |
| 111 // within the session. If |fetch_token_from_auth_code| is not set fetching |
| 112 // process stops after receiving an auth code and ClientOAuthSuccess won't be |
| 113 // called. |
| 114 // Resulting refresh token is annotated on the server with |device_id|. Format |
| 115 // of device_id on the server is at most 64 unicode characters. |
| 116 // |
| 117 // Either OnClientOAuthCode or ClientOAuthSuccess or OnClientOAuthFailure |
| 118 // will be called on the consumer on the original thread. |
| 119 void StartCookieForOAuthLoginTokenExchange( |
| 120 bool fetch_token_from_auth_code, |
| 121 const std::string& session_index, |
| 122 const std::string& client_id, |
| 123 const std::string& device_id); |
| 124 |
107 // Start a request to exchange the authorization code for an OAuthLogin-scoped | 125 // Start a request to exchange the authorization code for an OAuthLogin-scoped |
108 // oauth2 token. | 126 // oauth2 token. |
109 // | 127 // |
110 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be | 128 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be |
111 // called on the consumer on the original thread. | 129 // called on the consumer on the original thread. |
112 void StartAuthCodeForOAuth2TokenExchange(const std::string& auth_code); | 130 void StartAuthCodeForOAuth2TokenExchange(const std::string& auth_code); |
113 | 131 |
114 // Start a request to exchange the authorization code for an OAuthLogin-scoped | 132 // Start a request to exchange the authorization code for an OAuthLogin-scoped |
115 // oauth2 token. | 133 // oauth2 token. |
116 // Resulting refresh token is annotated on the server with |device_id|. Format | 134 // Resulting refresh token is annotated on the server with |device_id|. Format |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 const GURL list_accounts_gurl_; | 443 const GURL list_accounts_gurl_; |
426 const GURL logout_gurl_; | 444 const GURL logout_gurl_; |
427 const GURL get_check_connection_info_url_; | 445 const GURL get_check_connection_info_url_; |
428 const GURL oauth2_iframe_url_; | 446 const GURL oauth2_iframe_url_; |
429 | 447 |
430 // While a fetch is going on: | 448 // While a fetch is going on: |
431 scoped_ptr<net::URLFetcher> fetcher_; | 449 scoped_ptr<net::URLFetcher> fetcher_; |
432 GURL client_login_to_oauth2_gurl_; | 450 GURL client_login_to_oauth2_gurl_; |
433 std::string request_body_; | 451 std::string request_body_; |
434 std::string requested_service_; | 452 std::string requested_service_; |
435 bool fetch_pending_; | 453 bool fetch_pending_ = false; |
| 454 bool fetch_token_from_auth_code_ = false; |
436 | 455 |
437 // Headers used during the Logout call. | 456 // Headers used during the Logout call. |
438 std::string logout_headers_; | 457 std::string logout_headers_; |
439 | 458 |
440 friend class GaiaAuthFetcherTest; | 459 friend class GaiaAuthFetcherTest; |
441 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); | 460 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); |
442 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); | 461 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); |
443 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); | 462 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); |
444 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); | 463 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); |
445 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); | 464 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); |
446 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); | 465 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); |
447 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); | 466 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); |
448 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); | 467 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); |
449 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); | 468 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); |
450 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, | 469 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, |
451 ParseClientLoginToOAuth2Response); | 470 ParseClientLoginToOAuth2Response); |
452 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 471 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
453 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 472 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
454 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 473 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
455 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 474 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
456 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 475 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
457 | 476 |
458 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 477 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
459 }; | 478 }; |
460 | 479 |
461 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 480 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
OLD | NEW |