| 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 CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_H_ | 5 #ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_H_ |
| 6 #define CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_H_ | 6 #define CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void StartIssueAuthToken(const std::string& sid, | 66 void StartIssueAuthToken(const std::string& sid, |
| 67 const std::string& lsid, | 67 const std::string& lsid, |
| 68 const char* const service); | 68 const char* const service); |
| 69 | 69 |
| 70 // Start fetching OAuth login scoped token from the given ClientLogin token | 70 // Start fetching OAuth login scoped token from the given ClientLogin token |
| 71 // for "lso" service. | 71 // for "lso" service. |
| 72 // Either OnOAuthLoginTokenSuccess or OnOAuthLoginTokenFailure method will be | 72 // Either OnOAuthLoginTokenSuccess or OnOAuthLoginTokenFailure method will be |
| 73 // called on the consumer with results. | 73 // called on the consumer with results. |
| 74 void StartOAuthLoginTokenFetch(const std::string& auth_token); | 74 void StartOAuthLoginTokenFetch(const std::string& auth_token); |
| 75 | 75 |
| 76 // Start fetching OAuth login scoped token from information in the cookie jar |
| 77 // for "lso" service. In the case of sessions with multiple logged in |
| 78 /// accounts, |session_index| specifies which of the accounts to use. |
| 79 // Either OnOAuthLoginTokenSuccess or OnOAuthLoginTokenFailure method will be |
| 80 // called on the consumer with results. |
| 81 void StartOAuthLoginTokenFetchWithCookies(const std::string& session_index); |
| 82 |
| 76 // Start a request to get user info. | 83 // Start a request to get user info. |
| 77 // GaiaAuthConsumer will be called back on the same thread when | 84 // GaiaAuthConsumer will be called back on the same thread when |
| 78 // results come back. | 85 // results come back. |
| 79 // You can't make more than one request at a time. | 86 // You can't make more than one request at a time. |
| 80 void StartGetUserInfo(const std::string& lsid); | 87 void StartGetUserInfo(const std::string& lsid); |
| 81 | 88 |
| 82 // Start a TokenAuth request to pre-login the user with the given credentials. | 89 // Start a TokenAuth request to pre-login the user with the given credentials. |
| 83 void StartTokenAuth(const std::string& auth_token); | 90 void StartTokenAuth(const std::string& auth_token); |
| 84 | 91 |
| 85 // Start a MergeSession request to pre-login the user with the given | 92 // Start a MergeSession request to pre-login the user with the given |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 static GoogleServiceAuthError GenerateAuthError( | 287 static GoogleServiceAuthError GenerateAuthError( |
| 281 const std::string& data, | 288 const std::string& data, |
| 282 const net::URLRequestStatus& status); | 289 const net::URLRequestStatus& status); |
| 283 | 290 |
| 284 // These fields are common to GaiaAuthFetcher, same every request | 291 // These fields are common to GaiaAuthFetcher, same every request |
| 285 GaiaAuthConsumer* const consumer_; | 292 GaiaAuthConsumer* const consumer_; |
| 286 net::URLRequestContextGetter* const getter_; | 293 net::URLRequestContextGetter* const getter_; |
| 287 std::string source_; | 294 std::string source_; |
| 288 const GURL client_login_gurl_; | 295 const GURL client_login_gurl_; |
| 289 const GURL issue_auth_token_gurl_; | 296 const GURL issue_auth_token_gurl_; |
| 290 const GURL client_login_to_oauth2_gurl_; | |
| 291 const GURL oauth2_token_gurl_; | 297 const GURL oauth2_token_gurl_; |
| 292 const GURL get_user_info_gurl_; | 298 const GURL get_user_info_gurl_; |
| 293 const GURL token_auth_gurl_; | 299 const GURL token_auth_gurl_; |
| 294 const GURL merge_session_gurl_; | 300 const GURL merge_session_gurl_; |
| 295 const GURL uberauth_token_gurl_; | 301 const GURL uberauth_token_gurl_; |
| 296 | 302 |
| 297 // While a fetch is going on: | 303 // While a fetch is going on: |
| 298 scoped_ptr<content::URLFetcher> fetcher_; | 304 scoped_ptr<content::URLFetcher> fetcher_; |
| 305 GURL client_login_to_oauth2_gurl_; |
| 299 std::string request_body_; | 306 std::string request_body_; |
| 300 std::string requested_service_; // Currently tracked for IssueAuthToken only. | 307 std::string requested_service_; // Currently tracked for IssueAuthToken only. |
| 301 bool fetch_pending_; | 308 bool fetch_pending_; |
| 302 | 309 |
| 303 friend class GaiaAuthFetcherTest; | 310 friend class GaiaAuthFetcherTest; |
| 304 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); | 311 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); |
| 305 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); | 312 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); |
| 306 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); | 313 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); |
| 307 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); | 314 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); |
| 308 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); | 315 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); |
| 309 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); | 316 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); |
| 310 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); | 317 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); |
| 311 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); | 318 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); |
| 312 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); | 319 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); |
| 313 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, | 320 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, |
| 314 ParseClientLoginToOAuth2Response); | 321 ParseClientLoginToOAuth2Response); |
| 315 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 322 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
| 316 | 323 |
| 317 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 324 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
| 318 }; | 325 }; |
| 319 | 326 |
| 320 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_H_ | 327 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTH_FETCHER_H_ |
| OLD | NEW |