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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // called on the consumer on the original thread. | 100 // called on the consumer on the original thread. |
101 void StartLsoForOAuthLoginTokenExchange(const std::string& auth_token); | 101 void StartLsoForOAuthLoginTokenExchange(const std::string& auth_token); |
102 | 102 |
103 // Start a request to revoke |auth_token|. | 103 // Start a request to revoke |auth_token|. |
104 // | 104 // |
105 // OnOAuth2RevokeTokenCompleted will be called on the consumer on the original | 105 // OnOAuth2RevokeTokenCompleted will be called on the consumer on the original |
106 // thread. | 106 // thread. |
107 void StartRevokeOAuth2Token(const std::string& auth_token); | 107 void StartRevokeOAuth2Token(const std::string& auth_token); |
108 | 108 |
109 // Start a request to exchange the cookies of a signed-in user session | 109 // Start a request to exchange the cookies of a signed-in user session |
110 // for an OAuth2 authorization code. In the case of a session with | |
111 // multiple accounts signed in, |session_index| indicate the which of accounts | |
112 // within the session. | |
113 // | |
114 // Either OnClientOAuthCodeSuccess or OnClientOAuthCodeFailure will be | |
115 // called on the consumer on the original thread. | |
116 void StartCookieForOAuthCodeExchange(const std::string& session_index); | |
117 | |
118 // Start a request to exchange the cookies of a signed-in user session | |
119 // for an OAuthLogin-scoped oauth2 token. In the case of a session with | 110 // for an OAuthLogin-scoped oauth2 token. In the case of a session with |
120 // multiple accounts signed in, |session_index| indicate the which of accounts | 111 // multiple accounts signed in, |session_index| indicate the which of accounts |
121 // within the session. | 112 // within the session. |
122 // | 113 // |
123 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be | 114 // Either OnClientOAuthSuccess or OnClientOAuthFailure will be |
124 // called on the consumer on the original thread. | 115 // called on the consumer on the original thread. |
125 void StartCookieForOAuthLoginTokenExchange(const std::string& session_index); | 116 void StartCookieForOAuthLoginTokenExchange(const std::string& session_index); |
126 | 117 |
127 // Start a request to exchange the authorization code for an OAuthLogin-scoped | 118 // Start a request to exchange the authorization code for an OAuthLogin-scoped |
128 // oauth2 token. | 119 // oauth2 token. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 const GURL uberauth_token_gurl_; | 367 const GURL uberauth_token_gurl_; |
377 const GURL oauth_login_gurl_; | 368 const GURL oauth_login_gurl_; |
378 const GURL list_accounts_gurl_; | 369 const GURL list_accounts_gurl_; |
379 | 370 |
380 // While a fetch is going on: | 371 // While a fetch is going on: |
381 scoped_ptr<net::URLFetcher> fetcher_; | 372 scoped_ptr<net::URLFetcher> fetcher_; |
382 GURL client_login_to_oauth2_gurl_; | 373 GURL client_login_to_oauth2_gurl_; |
383 std::string request_body_; | 374 std::string request_body_; |
384 std::string requested_service_; // Currently tracked for IssueAuthToken only. | 375 std::string requested_service_; // Currently tracked for IssueAuthToken only. |
385 bool fetch_pending_; | 376 bool fetch_pending_; |
386 // This is to distinguish between the fetch for oauth login token and that for | |
387 // oauth code. | |
388 bool fetch_code_only_; | |
389 | 377 |
390 friend class GaiaAuthFetcherTest; | 378 friend class GaiaAuthFetcherTest; |
391 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); | 379 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); |
392 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); | 380 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); |
393 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); | 381 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); |
394 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); | 382 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); |
395 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); | 383 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); |
396 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); | 384 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); |
397 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); | 385 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); |
398 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); | 386 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); |
399 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); | 387 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); |
400 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, | 388 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, |
401 ParseClientLoginToOAuth2Response); | 389 ParseClientLoginToOAuth2Response); |
402 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 390 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
403 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 391 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
404 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 392 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
405 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 393 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
406 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 394 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
407 | 395 |
408 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 396 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
409 }; | 397 }; |
410 | 398 |
411 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 399 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
OLD | NEW |