| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auth/login_performer.h" | 5 #include "chrome/browser/chromeos/login/auth/login_performer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/chromeos/boot_times_loader.h" | 16 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 17 #include "chrome/browser/chromeos/login/login_utils.h" | 17 #include "chrome/browser/chromeos/login/login_utils.h" |
| 18 #include "chrome/browser/chromeos/login/managed/locally_managed_user_constants.h
" | 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 19 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" | 19 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" |
| 20 #include "chrome/browser/chromeos/login/managed/supervised_user_login_flow.h" | 20 #include "chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h" |
| 21 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 21 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 22 #include "chrome/browser/chromeos/login/users/user_manager.h" | 22 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 23 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 23 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 24 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 24 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 25 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 25 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 26 #include "chrome/browser/chromeos/settings/cros_settings.h" | 26 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chromeos/dbus/dbus_thread_manager.h" | 28 #include "chromeos/dbus/dbus_thread_manager.h" |
| 29 #include "chromeos/dbus/session_manager_client.h" | 29 #include "chromeos/dbus/session_manager_client.h" |
| 30 #include "chromeos/login/user_names.h" | 30 #include "chromeos/login/user_names.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 break; | 191 break; |
| 192 } | 192 } |
| 193 } else { | 193 } else { |
| 194 if (delegate_) | 194 if (delegate_) |
| 195 delegate_->WhiteListCheckFailed(user_context.GetUserID()); | 195 delegate_->WhiteListCheckFailed(user_context.GetUserID()); |
| 196 else | 196 else |
| 197 NOTREACHED(); | 197 NOTREACHED(); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 void LoginPerformer::LoginAsLocallyManagedUser( | 201 void LoginPerformer::LoginAsSupervisedUser( |
| 202 const UserContext& user_context) { | 202 const UserContext& user_context) { |
| 203 DCHECK_EQ(chromeos::login::kLocallyManagedUserDomain, | 203 DCHECK_EQ(chromeos::login::kSupervisedUserDomain, |
| 204 gaia::ExtractDomainName(user_context.GetUserID())); | 204 gaia::ExtractDomainName(user_context.GetUserID())); |
| 205 | 205 |
| 206 CrosSettings* cros_settings = CrosSettings::Get(); | 206 CrosSettings* cros_settings = CrosSettings::Get(); |
| 207 CrosSettingsProvider::TrustedStatus status = | 207 CrosSettingsProvider::TrustedStatus status = |
| 208 cros_settings->PrepareTrustedValues( | 208 cros_settings->PrepareTrustedValues( |
| 209 base::Bind(&LoginPerformer::LoginAsLocallyManagedUser, | 209 base::Bind(&LoginPerformer::LoginAsSupervisedUser, |
| 210 weak_factory_.GetWeakPtr(), | 210 weak_factory_.GetWeakPtr(), |
| 211 user_context_)); | 211 user_context_)); |
| 212 // Must not proceed without signature verification. | 212 // Must not proceed without signature verification. |
| 213 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { | 213 if (status == CrosSettingsProvider::PERMANENTLY_UNTRUSTED) { |
| 214 if (delegate_) | 214 if (delegate_) |
| 215 delegate_->PolicyLoadFailed(); | 215 delegate_->PolicyLoadFailed(); |
| 216 else | 216 else |
| 217 NOTREACHED(); | 217 NOTREACHED(); |
| 218 return; | 218 return; |
| 219 } else if (status != CrosSettingsProvider::TRUSTED) { | 219 } else if (status != CrosSettingsProvider::TRUSTED) { |
| 220 // Value of kAccountsPrefSupervisedUsersEnabled setting is still not | 220 // Value of kAccountsPrefSupervisedUsersEnabled setting is still not |
| 221 // verified. Another attempt will be invoked after verification completion. | 221 // verified. Another attempt will be invoked after verification completion. |
| 222 return; | 222 return; |
| 223 } | 223 } |
| 224 | 224 |
| 225 if (!UserManager::Get()->AreLocallyManagedUsersAllowed()) { | 225 if (!UserManager::Get()->AreSupervisedUsersAllowed()) { |
| 226 LOG(ERROR) << "Login attempt of locally managed user detected."; | 226 LOG(ERROR) << "Login attempt of supervised user detected."; |
| 227 delegate_->WhiteListCheckFailed(user_context.GetUserID()); | 227 delegate_->WhiteListCheckFailed(user_context.GetUserID()); |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 | 230 |
| 231 SupervisedUserLoginFlow* new_flow = | 231 SupervisedUserLoginFlow* new_flow = |
| 232 new SupervisedUserLoginFlow(user_context.GetUserID()); | 232 new SupervisedUserLoginFlow(user_context.GetUserID()); |
| 233 new_flow->set_host( | 233 new_flow->set_host( |
| 234 UserManager::Get()->GetUserFlow(user_context.GetUserID())->host()); | 234 UserManager::Get()->GetUserFlow(user_context.GetUserID())->host()); |
| 235 UserManager::Get()->SetUserFlow(user_context.GetUserID(), new_flow); | 235 UserManager::Get()->SetUserFlow(user_context.GetUserID(), new_flow); |
| 236 | 236 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 253 base::Bind(&ExtendedAuthenticator::AuthenticateToMount, | 253 base::Bind(&ExtendedAuthenticator::AuthenticateToMount, |
| 254 extended_authenticator_.get(), | 254 extended_authenticator_.get(), |
| 255 user_context_copy, | 255 user_context_copy, |
| 256 ExtendedAuthenticator::ResultCallback())); | 256 ExtendedAuthenticator::ResultCallback())); |
| 257 | 257 |
| 258 } else { | 258 } else { |
| 259 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 259 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
| 260 BrowserThread::PostTask( | 260 BrowserThread::PostTask( |
| 261 BrowserThread::UI, | 261 BrowserThread::UI, |
| 262 FROM_HERE, | 262 FROM_HERE, |
| 263 base::Bind(&Authenticator::LoginAsLocallyManagedUser, | 263 base::Bind(&Authenticator::LoginAsSupervisedUser, |
| 264 authenticator_.get(), | 264 authenticator_.get(), |
| 265 user_context_copy)); | 265 user_context_copy)); |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 void LoginPerformer::LoginRetailMode() { | 269 void LoginPerformer::LoginRetailMode() { |
| 270 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 270 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
| 271 BrowserThread::PostTask( | 271 BrowserThread::PostTask( |
| 272 BrowserThread::UI, FROM_HERE, | 272 BrowserThread::UI, FROM_HERE, |
| 273 base::Bind(&Authenticator::LoginRetailMode, authenticator_.get())); | 273 base::Bind(&Authenticator::LoginRetailMode, authenticator_.get())); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 policy::WildcardLoginChecker::Result result) { | 363 policy::WildcardLoginChecker::Result result) { |
| 364 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { | 364 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { |
| 365 StartLoginCompletion(); | 365 StartLoginCompletion(); |
| 366 } else { | 366 } else { |
| 367 if (delegate_) | 367 if (delegate_) |
| 368 delegate_->WhiteListCheckFailed(user_context_.GetUserID()); | 368 delegate_->WhiteListCheckFailed(user_context_.GetUserID()); |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace chromeos | 372 } // namespace chromeos |
| OLD | NEW |