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 #include "chrome/browser/chromeos/login/login_performer.h" | 5 #include "chrome/browser/chromeos/login/login_performer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
18 #include "chrome/browser/chromeos/boot_times_loader.h" | 18 #include "chrome/browser/chromeos/boot_times_loader.h" |
19 #include "chrome/browser/chromeos/login/login_utils.h" | 19 #include "chrome/browser/chromeos/login/login_utils.h" |
20 #include "chrome/browser/chromeos/login/managed/locally_managed_user_login_flow.
h" | 20 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" |
| 21 #include "chrome/browser/chromeos/login/managed/supervised_user_login_flow.h" |
| 22 #include "chrome/browser/chromeos/login/supervised_user_manager.h" |
21 #include "chrome/browser/chromeos/login/user_manager.h" | 23 #include "chrome/browser/chromeos/login/user_manager.h" |
22 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 24 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
23 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 25 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
24 #include "chrome/browser/chromeos/settings/cros_settings.h" | 26 #include "chrome/browser/chromeos/settings/cros_settings.h" |
25 #include "chrome/browser/policy/browser_policy_connector.h" | 27 #include "chrome/browser/policy/browser_policy_connector.h" |
26 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
27 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
28 #include "chromeos/dbus/session_manager_client.h" | 30 #include "chromeos/dbus/session_manager_client.h" |
29 #include "chromeos/settings/cros_settings_names.h" | 31 #include "chromeos/settings/cros_settings_names.h" |
30 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // verified. Another attempt will be invoked after verification completion. | 204 // verified. Another attempt will be invoked after verification completion. |
203 return; | 205 return; |
204 } | 206 } |
205 | 207 |
206 if (!UserManager::Get()->AreLocallyManagedUsersAllowed()) { | 208 if (!UserManager::Get()->AreLocallyManagedUsersAllowed()) { |
207 LOG(ERROR) << "Login attempt of locally managed user detected."; | 209 LOG(ERROR) << "Login attempt of locally managed user detected."; |
208 delegate_->WhiteListCheckFailed(user_context.username); | 210 delegate_->WhiteListCheckFailed(user_context.username); |
209 return; | 211 return; |
210 } | 212 } |
211 | 213 |
212 UserFlow* new_flow = new LocallyManagedUserLoginFlow(user_context.username); | 214 SupervisedUserLoginFlow* new_flow = |
| 215 new SupervisedUserLoginFlow(user_context.username); |
213 new_flow->set_host( | 216 new_flow->set_host( |
214 UserManager::Get()->GetUserFlow(user_context.username)->host()); | 217 UserManager::Get()->GetUserFlow(user_context.username)->host()); |
215 UserManager::Get()->SetUserFlow(user_context.username, new_flow); | 218 UserManager::Get()->SetUserFlow(user_context.username, new_flow); |
216 | 219 |
| 220 SupervisedUserAuthentication* authentication = UserManager::Get()-> |
| 221 GetSupervisedUserManager()->GetAuthentication(); |
| 222 |
| 223 if (authentication->PasswordNeedsMigration(user_context.username)) { |
| 224 authentication->SchedulePasswordMigration(user_context.username, |
| 225 user_context.password, |
| 226 new_flow); |
| 227 } |
| 228 |
| 229 UserContext user_context_copy( |
| 230 user_context.username, |
| 231 user_context.password, |
| 232 user_context.auth_code, |
| 233 user_context.username_hash, |
| 234 user_context.using_oauth); |
| 235 |
| 236 user_context_copy.password = authentication->TransformPassword( |
| 237 user_context_copy.username, |
| 238 user_context_copy.password); |
| 239 |
217 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 240 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
218 BrowserThread::PostTask( | 241 BrowserThread::PostTask( |
219 BrowserThread::UI, FROM_HERE, | 242 BrowserThread::UI, FROM_HERE, |
220 base::Bind(&Authenticator::LoginAsLocallyManagedUser, | 243 base::Bind(&Authenticator::LoginAsLocallyManagedUser, |
221 authenticator_.get(), | 244 authenticator_.get(), |
222 user_context)); | 245 user_context_copy)); |
223 } | 246 } |
224 | 247 |
225 void LoginPerformer::LoginRetailMode() { | 248 void LoginPerformer::LoginRetailMode() { |
226 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 249 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
227 BrowserThread::PostTask( | 250 BrowserThread::PostTask( |
228 BrowserThread::UI, FROM_HERE, | 251 BrowserThread::UI, FROM_HERE, |
229 base::Bind(&Authenticator::LoginRetailMode, authenticator_.get())); | 252 base::Bind(&Authenticator::LoginRetailMode, authenticator_.get())); |
230 } | 253 } |
231 | 254 |
232 void LoginPerformer::LoginOffTheRecord() { | 255 void LoginPerformer::LoginOffTheRecord() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // state in the case when offline login fails. | 333 // state in the case when offline login fails. |
311 online_attempt_host_.Check(profile, user_context_); | 334 online_attempt_host_.Check(profile, user_context_); |
312 } else { | 335 } else { |
313 NOTREACHED(); | 336 NOTREACHED(); |
314 } | 337 } |
315 user_context_.password.clear(); | 338 user_context_.password.clear(); |
316 user_context_.auth_code.clear(); | 339 user_context_.auth_code.clear(); |
317 } | 340 } |
318 | 341 |
319 } // namespace chromeos | 342 } // namespace chromeos |
OLD | NEW |