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