| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Use this class to authenticate users with Gaia and access cookies sent | 5 // Use this class to authenticate users with Gaia and access cookies sent |
| 6 // by the Gaia servers. This class cannot be used on its own becaue it relies | 6 // by the Gaia servers. This class cannot be used on its own becaue it relies |
| 7 // on a subclass to provide the virtual Post and GetBackoffDelaySeconds methods. | 7 // on a subclass to provide the virtual Post and GetBackoffDelaySeconds methods. |
| 8 // | 8 // |
| 9 // Sample usage: | 9 // Sample usage: |
| 10 // class ActualGaiaAuthenticator : public gaia::GaiaAuthenticator { | 10 // class ActualGaiaAuthenticator : public gaia::GaiaAuthenticator { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void SetUsernamePassword(const std::string& username, | 124 void SetUsernamePassword(const std::string& username, |
| 125 const std::string& password); | 125 const std::string& password); |
| 126 | 126 |
| 127 void SetUsername(const std::string& username); | 127 void SetUsername(const std::string& username); |
| 128 | 128 |
| 129 // Virtual for testing | 129 // Virtual for testing |
| 130 virtual void RenewAuthToken(const std::string& auth_token); | 130 virtual void RenewAuthToken(const std::string& auth_token); |
| 131 void SetAuthToken(const std::string& auth_token); | 131 void SetAuthToken(const std::string& auth_token); |
| 132 | 132 |
| 133 struct AuthResults { | 133 struct AuthResults { |
| 134 AuthResults(); |
| 135 ~AuthResults(); |
| 136 |
| 134 std::string email; | 137 std::string email; |
| 135 std::string password; | 138 std::string password; |
| 136 | 139 |
| 137 // Fields that store various cookies. | 140 // Fields that store various cookies. |
| 138 std::string sid; | 141 std::string sid; |
| 139 std::string lsid; | 142 std::string lsid; |
| 140 std::string auth_token; | 143 std::string auth_token; |
| 141 | 144 |
| 142 std::string primary_email; | 145 std::string primary_email; |
| 143 | 146 |
| 144 // Fields for items returned when authentication fails. | 147 // Fields for items returned when authentication fails. |
| 145 std::string error_msg; | 148 std::string error_msg; |
| 146 enum AuthenticationError auth_error; | 149 enum AuthenticationError auth_error; |
| 147 std::string auth_error_url; | 150 std::string auth_error_url; |
| 148 std::string captcha_token; | 151 std::string captcha_token; |
| 149 std::string captcha_url; | 152 std::string captcha_url; |
| 150 | |
| 151 AuthResults() : auth_error(None) {} | |
| 152 }; | 153 }; |
| 153 | 154 |
| 154 protected: | 155 protected: |
| 155 | 156 |
| 156 struct AuthParams { | 157 struct AuthParams { |
| 158 AuthParams(); |
| 159 ~AuthParams(); |
| 160 |
| 157 GaiaAuthenticator* authenticator; | 161 GaiaAuthenticator* authenticator; |
| 158 uint32 request_id; | 162 uint32 request_id; |
| 159 std::string email; | 163 std::string email; |
| 160 std::string password; | 164 std::string password; |
| 161 std::string captcha_token; | 165 std::string captcha_token; |
| 162 std::string captcha_value; | 166 std::string captcha_value; |
| 163 }; | 167 }; |
| 164 | 168 |
| 165 // mutex_ must be entered before calling this function. | 169 // mutex_ must be entered before calling this function. |
| 166 AuthParams MakeParams(const std::string& user_name, | 170 AuthParams MakeParams(const std::string& user_name, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 #endif // defined(OS_WIN) | 299 #endif // defined(OS_WIN) |
| 296 int early_auth_attempt_count_; | 300 int early_auth_attempt_count_; |
| 297 | 301 |
| 298 // The message loop all our methods are invoked on. | 302 // The message loop all our methods are invoked on. |
| 299 const MessageLoop* message_loop_; | 303 const MessageLoop* message_loop_; |
| 300 }; | 304 }; |
| 301 | 305 |
| 302 } // namespace gaia | 306 } // namespace gaia |
| 303 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_ | 307 #endif // CHROME_COMMON_NET_GAIA_GAIA_AUTHENTICATOR_H_ |
| 304 | 308 |
| OLD | NEW |