OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_AUTHENTICATOR2_H_ | 5 #ifndef CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR2_H_ |
6 #define CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR2_H_ | 6 #define CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR2_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 12 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
13 #include "chrome/common/net/url_fetcher.h" | 13 #include "chrome/common/net/url_fetcher.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
16 // Authenticate a user against the Google Accounts ClientLogin API | 16 // Authenticate a user against the Google Accounts ClientLogin API |
17 // with various capabilities and return results to a GaiaAuthConsumer. | 17 // with various capabilities and return results to a GaiaAuthConsumer. |
18 // | 18 // |
19 // In the future, we will also issue auth tokens from this class. | 19 // In the future, we will also issue auth tokens from this class. |
20 // This class should be used on a single thread, but it can be whichever thread | 20 // This class should be used on a single thread, but it can be whichever thread |
21 // that you like. | 21 // that you like. |
22 // | 22 // |
23 // This class can handle one request at a time. To parallelize requests, | 23 // This class can handle one request at a time. To parallelize requests, |
24 // create multiple GaiaAuthenticator2's. | 24 // create multiple GaiaAuthenticator2's. |
25 | 25 |
26 class GaiaAuthenticator2Test; | 26 class GaiaAuthenticator2Test; |
27 | 27 |
| 28 // TODO(chron): Rename this to GaiaAuthFetcher or something. |
28 class GaiaAuthenticator2 : public URLFetcher::Delegate { | 29 class GaiaAuthenticator2 : public URLFetcher::Delegate { |
29 public: | 30 public: |
30 // Constants to use in the ClientLogin request POST body. | |
31 static const char kChromeOSSource[]; | |
32 static const char kContactsService[]; | |
33 | |
34 // The URLs for different calls in the Google Accounts programmatic login API. | 31 // The URLs for different calls in the Google Accounts programmatic login API. |
35 static const char kClientLoginUrl[]; | 32 static const char kClientLoginUrl[]; |
36 static const char kIssueAuthTokenUrl[]; | 33 static const char kIssueAuthTokenUrl[]; |
37 | 34 |
38 // Magic string indicating that, while a second factor is still | 35 // Magic string indicating that, while a second factor is still |
39 // needed to complete authentication, the user provided the right password. | 36 // needed to complete authentication, the user provided the right password. |
40 static const char kSecondFactor[]; | 37 static const char kSecondFactor[]; |
41 | 38 |
42 // This will later be hidden behind an auth service which caches | 39 // This will later be hidden behind an auth service which caches |
43 // tokens. | 40 // tokens. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 145 |
149 friend class GaiaAuthenticator2Test; | 146 friend class GaiaAuthenticator2Test; |
150 FRIEND_TEST_ALL_PREFIXES(GaiaAuthenticator2Test, LoginNetFailure); | 147 FRIEND_TEST_ALL_PREFIXES(GaiaAuthenticator2Test, LoginNetFailure); |
151 FRIEND_TEST_ALL_PREFIXES(GaiaAuthenticator2Test, CheckNormalErrorCode); | 148 FRIEND_TEST_ALL_PREFIXES(GaiaAuthenticator2Test, CheckNormalErrorCode); |
152 FRIEND_TEST_ALL_PREFIXES(GaiaAuthenticator2Test, CheckTwoFactorResponse); | 149 FRIEND_TEST_ALL_PREFIXES(GaiaAuthenticator2Test, CheckTwoFactorResponse); |
153 | 150 |
154 DISALLOW_COPY_AND_ASSIGN(GaiaAuthenticator2); | 151 DISALLOW_COPY_AND_ASSIGN(GaiaAuthenticator2); |
155 }; | 152 }; |
156 | 153 |
157 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR2_H_ | 154 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR2_H_ |
OLD | NEW |