| 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/chrome_login_performer.h" | 5 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow.
h" | 10 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_user_login_flow.
h" |
| 11 #include "chrome/browser/chromeos/login/helper.h" | 11 #include "chrome/browser/chromeos/login/helper.h" |
| 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 13 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 13 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 14 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" | 14 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" |
| 15 #include "chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h" | 15 #include "chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h" |
| 16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 16 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 17 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 17 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 19 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 19 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 21 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 22 #include "components/signin/core/account_id/account_id.h" | |
| 23 | 22 |
| 24 namespace chromeos { | 23 namespace chromeos { |
| 25 | 24 |
| 26 ChromeLoginPerformer::ChromeLoginPerformer(Delegate* delegate) | 25 ChromeLoginPerformer::ChromeLoginPerformer(Delegate* delegate) |
| 27 : LoginPerformer(base::ThreadTaskRunnerHandle::Get(), delegate), | 26 : LoginPerformer(base::ThreadTaskRunnerHandle::Get(), delegate), |
| 28 weak_factory_(this) {} | 27 weak_factory_(this) {} |
| 29 | 28 |
| 30 ChromeLoginPerformer::~ChromeLoginPerformer() { | 29 ChromeLoginPerformer::~ChromeLoginPerformer() { |
| 31 } | 30 } |
| 32 | 31 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 123 } |
| 125 | 124 |
| 126 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { | 125 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { |
| 127 return user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); | 126 return user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); |
| 128 } | 127 } |
| 129 | 128 |
| 130 bool ChromeLoginPerformer::UseExtendedAuthenticatorForSupervisedUser( | 129 bool ChromeLoginPerformer::UseExtendedAuthenticatorForSupervisedUser( |
| 131 const UserContext& user_context) { | 130 const UserContext& user_context) { |
| 132 SupervisedUserAuthentication* authentication = | 131 SupervisedUserAuthentication* authentication = |
| 133 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 132 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); |
| 134 return authentication->GetPasswordSchema( | 133 return authentication->GetPasswordSchema(user_context.GetUserID()) == |
| 135 user_context.GetAccountId().GetUserEmail()) == | |
| 136 SupervisedUserAuthentication::SCHEMA_SALT_HASHED; | 134 SupervisedUserAuthentication::SCHEMA_SALT_HASHED; |
| 137 } | 135 } |
| 138 | 136 |
| 139 UserContext ChromeLoginPerformer::TransformSupervisedKey( | 137 UserContext ChromeLoginPerformer::TransformSupervisedKey( |
| 140 const UserContext& context) { | 138 const UserContext& context) { |
| 141 SupervisedUserAuthentication* authentication = | 139 SupervisedUserAuthentication* authentication = |
| 142 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 140 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); |
| 143 return authentication->TransformKey(context); | 141 return authentication->TransformKey(context); |
| 144 } | 142 } |
| 145 | 143 |
| 146 void ChromeLoginPerformer::SetupSupervisedUserFlow(const std::string& user_id) { | 144 void ChromeLoginPerformer::SetupSupervisedUserFlow(const std::string& user_id) { |
| 147 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(user_id); | 145 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(user_id); |
| 148 new_flow->SetHost(ChromeUserManager::Get() | 146 new_flow->SetHost(ChromeUserManager::Get()->GetUserFlow(user_id)->host()); |
| 149 ->GetUserFlow(AccountId::FromUserEmail(user_id)) | 147 ChromeUserManager::Get()->SetUserFlow(user_id, new_flow); |
| 150 ->host()); | |
| 151 ChromeUserManager::Get()->SetUserFlow(AccountId::FromUserEmail(user_id), | |
| 152 new_flow); | |
| 153 } | 148 } |
| 154 | 149 |
| 155 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(const std::string& user_id) { | 150 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(const std::string& user_id) { |
| 156 ChromeUserManager::Get()->SetUserFlow(AccountId::FromUserEmail(user_id), | 151 ChromeUserManager::Get()->SetUserFlow(user_id, |
| 157 new EasyUnlockUserLoginFlow(user_id)); | 152 new EasyUnlockUserLoginFlow(user_id)); |
| 158 } | 153 } |
| 159 | 154 |
| 160 bool ChromeLoginPerformer::CheckPolicyForUser(const std::string& user_id) { | 155 bool ChromeLoginPerformer::CheckPolicyForUser(const std::string& user_id) { |
| 161 // Login is not allowed if policy could not be loaded for the account. | 156 // Login is not allowed if policy could not be loaded for the account. |
| 162 policy::BrowserPolicyConnectorChromeOS* connector = | 157 policy::BrowserPolicyConnectorChromeOS* connector = |
| 163 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 158 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 164 policy::DeviceLocalAccountPolicyService* policy_service = | 159 policy::DeviceLocalAccountPolicyService* policy_service = |
| 165 connector->GetDeviceLocalAccountPolicyService(); | 160 connector->GetDeviceLocalAccountPolicyService(); |
| 166 return policy_service && policy_service->IsPolicyAvailableForUser(user_id); | 161 return policy_service && policy_service->IsPolicyAvailableForUser(user_id); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 181 const base::Closure& failure_callback, | 176 const base::Closure& failure_callback, |
| 182 policy::WildcardLoginChecker::Result result) { | 177 policy::WildcardLoginChecker::Result result) { |
| 183 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { | 178 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { |
| 184 success_callback.Run(); | 179 success_callback.Run(); |
| 185 } else { | 180 } else { |
| 186 failure_callback.Run(); | 181 failure_callback.Run(); |
| 187 } | 182 } |
| 188 } | 183 } |
| 189 | 184 |
| 190 } // namespace chromeos | 185 } // namespace chromeos |
| OLD | NEW |