| 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 26 matching lines...) Expand all Loading... |
| 37 public: | 37 public: |
| 38 enum HostedAccountsSetting { | 38 enum HostedAccountsSetting { |
| 39 HostedAccountsAllowed, | 39 HostedAccountsAllowed, |
| 40 HostedAccountsNotAllowed | 40 HostedAccountsNotAllowed |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // Magic string indicating that, while a second factor is still | 43 // Magic string indicating that, while a second factor is still |
| 44 // needed to complete authentication, the user provided the right password. | 44 // needed to complete authentication, the user provided the right password. |
| 45 static const char kSecondFactor[]; | 45 static const char kSecondFactor[]; |
| 46 | 46 |
| 47 // Build URLs for these endpoints with the given source parameter. |
| 48 static GURL BuildListAccountsURL(const std::string& source); |
| 49 static GURL BuildGetCheckConnectionInfoURL(const std::string& source); |
| 50 |
| 47 // This will later be hidden behind an auth service which caches | 51 // This will later be hidden behind an auth service which caches |
| 48 // tokens. | 52 // tokens. |
| 49 GaiaAuthFetcher(GaiaAuthConsumer* consumer, | 53 GaiaAuthFetcher(GaiaAuthConsumer* consumer, |
| 50 const std::string& source, | 54 const std::string& source, |
| 51 net::URLRequestContextGetter* getter); | 55 net::URLRequestContextGetter* getter); |
| 52 virtual ~GaiaAuthFetcher(); | 56 virtual ~GaiaAuthFetcher(); |
| 53 | 57 |
| 54 // Start a request to obtain the SID and LSID cookies for the the account | 58 // Start a request to obtain the SID and LSID cookies for the the account |
| 55 // identified by |username| and |password|. If |service| is not null or | 59 // identified by |username| and |password|. If |service| is not null or |
| 56 // empty, then also obtains a service token for specified service. | 60 // empty, then also obtains a service token for specified service. |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 int load_flags, | 386 int load_flags, |
| 383 net::URLFetcherDelegate* delegate); | 387 net::URLFetcherDelegate* delegate); |
| 384 | 388 |
| 385 // From a URLFetcher result, generate an appropriate error. | 389 // From a URLFetcher result, generate an appropriate error. |
| 386 // From the API documentation, both IssueAuthToken and ClientLogin have | 390 // From the API documentation, both IssueAuthToken and ClientLogin have |
| 387 // the same error returns. | 391 // the same error returns. |
| 388 static GoogleServiceAuthError GenerateAuthError( | 392 static GoogleServiceAuthError GenerateAuthError( |
| 389 const std::string& data, | 393 const std::string& data, |
| 390 const net::URLRequestStatus& status); | 394 const net::URLRequestStatus& status); |
| 391 | 395 |
| 392 // These fields are common to GaiaAuthFetcher, same every request | 396 // These fields are common to GaiaAuthFetcher, same every request. |
| 393 GaiaAuthConsumer* const consumer_; | 397 GaiaAuthConsumer* const consumer_; |
| 394 net::URLRequestContextGetter* const getter_; | 398 net::URLRequestContextGetter* const getter_; |
| 395 std::string source_; | 399 std::string source_; |
| 396 const GURL client_login_gurl_; | 400 const GURL client_login_gurl_; |
| 397 const GURL issue_auth_token_gurl_; | 401 const GURL issue_auth_token_gurl_; |
| 398 const GURL oauth2_token_gurl_; | 402 const GURL oauth2_token_gurl_; |
| 399 const GURL oauth2_revoke_gurl_; | 403 const GURL oauth2_revoke_gurl_; |
| 400 const GURL get_user_info_gurl_; | 404 const GURL get_user_info_gurl_; |
| 401 const GURL merge_session_gurl_; | 405 const GURL merge_session_gurl_; |
| 402 const GURL uberauth_token_gurl_; | 406 const GURL uberauth_token_gurl_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 426 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 430 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
| 427 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 431 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
| 428 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 432 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
| 429 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 433 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
| 430 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 434 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
| 431 | 435 |
| 432 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 436 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
| 433 }; | 437 }; |
| 434 | 438 |
| 435 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 439 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
| OLD | NEW |