OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_CHROMEOS_LOGIN_PARALLEL_AUTHENTICATOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_PARALLEL_AUTHENTICATOR_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PARALLEL_AUTHENTICATOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_PARALLEL_AUTHENTICATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 UNLOCK, // Screen unlock succeeded. | 77 UNLOCK, // Screen unlock succeeded. |
78 LOCAL_LOGIN, // Login with localaccount succeded. | 78 LOCAL_LOGIN, // Login with localaccount succeded. |
79 ONLINE_FAILED, // Online login disallowed, but offline succeeded. | 79 ONLINE_FAILED, // Online login disallowed, but offline succeeded. |
80 LOGIN_FAILED // Login denied. | 80 LOGIN_FAILED // Login denied. |
81 }; | 81 }; |
82 | 82 |
83 explicit ParallelAuthenticator(LoginStatusConsumer* consumer); | 83 explicit ParallelAuthenticator(LoginStatusConsumer* consumer); |
84 virtual ~ParallelAuthenticator(); | 84 virtual ~ParallelAuthenticator(); |
85 | 85 |
86 // Authenticator overrides. | 86 // Authenticator overrides. |
87 virtual bool CompleteLogin(Profile* profile, | 87 virtual void CompleteLogin(Profile* profile, |
88 const std::string& username, | 88 const std::string& username, |
89 const std::string& password) OVERRIDE; | 89 const std::string& password) OVERRIDE; |
90 | 90 |
91 // Given a |username| and |password|, this method attempts to authenticate to | 91 // Given a |username| and |password|, this method attempts to authenticate to |
92 // the Google accounts servers and your Chrome OS device simultaneously. | 92 // the Google accounts servers and your Chrome OS device simultaneously. |
93 // As soon as we have successfully mounted the encrypted home directory for | 93 // As soon as we have successfully mounted the encrypted home directory for |
94 // |username|, we will call consumer_->OnLoginSuccess() with |username| and a | 94 // |username|, we will call consumer_->OnLoginSuccess() with |username| and a |
95 // vector of authentication cookies. If we're still waiting for an online | 95 // vector of authentication cookies. If we're still waiting for an online |
96 // result at that time, we'll also pass back a flag indicating that more | 96 // result at that time, we'll also pass back a flag indicating that more |
97 // callbacks are on the way; if not, we pass back false. When the pending | 97 // callbacks are on the way; if not, we pass back false. When the pending |
(...skipping 10 matching lines...) Expand all Loading... |
108 // | 108 // |
109 // Uses |profile| when doing URL fetches. | 109 // Uses |profile| when doing URL fetches. |
110 // Optionally could pass CAPTCHA challenge token - |login_token| and | 110 // Optionally could pass CAPTCHA challenge token - |login_token| and |
111 // |login_captcha| string that user has entered. | 111 // |login_captcha| string that user has entered. |
112 // | 112 // |
113 // NOTE: We do not allow HOSTED accounts to log in. In the event that | 113 // NOTE: We do not allow HOSTED accounts to log in. In the event that |
114 // we are asked to authenticate valid HOSTED account creds, we will | 114 // we are asked to authenticate valid HOSTED account creds, we will |
115 // call OnLoginFailure() with HOSTED_NOT_ALLOWED. | 115 // call OnLoginFailure() with HOSTED_NOT_ALLOWED. |
116 // | 116 // |
117 // Returns true if the attempt gets sent successfully and false if not. | 117 // Returns true if the attempt gets sent successfully and false if not. |
118 virtual bool AuthenticateToLogin(Profile* profile, | 118 virtual void AuthenticateToLogin(Profile* profile, |
119 const std::string& username, | 119 const std::string& username, |
120 const std::string& password, | 120 const std::string& password, |
121 const std::string& login_token, | 121 const std::string& login_token, |
122 const std::string& login_captcha) OVERRIDE; | 122 const std::string& login_captcha) OVERRIDE; |
123 | 123 |
124 // Given a |username| and |password|, this method attempts to | 124 // Given a |username| and |password|, this method attempts to |
125 // authenticate to the cached credentials. This will never contact | 125 // authenticate to the cached credentials. This will never contact |
126 // the server even if it's online. The auth result is sent to | 126 // the server even if it's online. The auth result is sent to |
127 // LoginStatusConsumer in a same way as AuthenticateToLogin does. | 127 // LoginStatusConsumer in a same way as AuthenticateToLogin does. |
128 virtual bool AuthenticateToUnlock(const std::string& username, | 128 virtual bool AuthenticateToUnlock(const std::string& username, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 FRIEND_TEST_ALL_PREFIXES(ParallelAuthenticatorTest, ReadLocalaccount); | 307 FRIEND_TEST_ALL_PREFIXES(ParallelAuthenticatorTest, ReadLocalaccount); |
308 FRIEND_TEST_ALL_PREFIXES(ParallelAuthenticatorTest, | 308 FRIEND_TEST_ALL_PREFIXES(ParallelAuthenticatorTest, |
309 ReadLocalaccountTrailingWS); | 309 ReadLocalaccountTrailingWS); |
310 FRIEND_TEST_ALL_PREFIXES(ParallelAuthenticatorTest, ReadNoLocalaccount); | 310 FRIEND_TEST_ALL_PREFIXES(ParallelAuthenticatorTest, ReadNoLocalaccount); |
311 DISALLOW_COPY_AND_ASSIGN(ParallelAuthenticator); | 311 DISALLOW_COPY_AND_ASSIGN(ParallelAuthenticator); |
312 }; | 312 }; |
313 | 313 |
314 } // namespace chromeos | 314 } // namespace chromeos |
315 | 315 |
316 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PARALLEL_AUTHENTICATOR_H_ | 316 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_PARALLEL_AUTHENTICATOR_H_ |
OLD | NEW |