| 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" |
| 22 | 23 |
| 23 namespace chromeos { | 24 namespace chromeos { |
| 24 | 25 |
| 25 ChromeLoginPerformer::ChromeLoginPerformer(Delegate* delegate) | 26 ChromeLoginPerformer::ChromeLoginPerformer(Delegate* delegate) |
| 26 : LoginPerformer(base::ThreadTaskRunnerHandle::Get(), delegate), | 27 : LoginPerformer(base::ThreadTaskRunnerHandle::Get(), delegate), |
| 27 weak_factory_(this) {} | 28 weak_factory_(this) {} |
| 28 | 29 |
| 29 ChromeLoginPerformer::~ChromeLoginPerformer() { | 30 ChromeLoginPerformer::~ChromeLoginPerformer() { |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 124 } |
| 124 | 125 |
| 125 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { | 126 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { |
| 126 return user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); | 127 return user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); |
| 127 } | 128 } |
| 128 | 129 |
| 129 bool ChromeLoginPerformer::UseExtendedAuthenticatorForSupervisedUser( | 130 bool ChromeLoginPerformer::UseExtendedAuthenticatorForSupervisedUser( |
| 130 const UserContext& user_context) { | 131 const UserContext& user_context) { |
| 131 SupervisedUserAuthentication* authentication = | 132 SupervisedUserAuthentication* authentication = |
| 132 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 133 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); |
| 133 return authentication->GetPasswordSchema(user_context.GetUserID()) == | 134 return authentication->GetPasswordSchema( |
| 135 user_context.GetAccountId().GetUserEmail()) == |
| 134 SupervisedUserAuthentication::SCHEMA_SALT_HASHED; | 136 SupervisedUserAuthentication::SCHEMA_SALT_HASHED; |
| 135 } | 137 } |
| 136 | 138 |
| 137 UserContext ChromeLoginPerformer::TransformSupervisedKey( | 139 UserContext ChromeLoginPerformer::TransformSupervisedKey( |
| 138 const UserContext& context) { | 140 const UserContext& context) { |
| 139 SupervisedUserAuthentication* authentication = | 141 SupervisedUserAuthentication* authentication = |
| 140 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 142 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); |
| 141 return authentication->TransformKey(context); | 143 return authentication->TransformKey(context); |
| 142 } | 144 } |
| 143 | 145 |
| 144 void ChromeLoginPerformer::SetupSupervisedUserFlow(const std::string& user_id) { | 146 void ChromeLoginPerformer::SetupSupervisedUserFlow(const std::string& user_id) { |
| 145 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(user_id); | 147 SupervisedUserLoginFlow* new_flow = new SupervisedUserLoginFlow(user_id); |
| 146 new_flow->SetHost(ChromeUserManager::Get()->GetUserFlow(user_id)->host()); | 148 new_flow->SetHost(ChromeUserManager::Get() |
| 147 ChromeUserManager::Get()->SetUserFlow(user_id, new_flow); | 149 ->GetUserFlow(AccountId::FromUserEmail(user_id)) |
| 150 ->host()); |
| 151 ChromeUserManager::Get()->SetUserFlow(AccountId::FromUserEmail(user_id), |
| 152 new_flow); |
| 148 } | 153 } |
| 149 | 154 |
| 150 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(const std::string& user_id) { | 155 void ChromeLoginPerformer::SetupEasyUnlockUserFlow(const std::string& user_id) { |
| 151 ChromeUserManager::Get()->SetUserFlow(user_id, | 156 ChromeUserManager::Get()->SetUserFlow(AccountId::FromUserEmail(user_id), |
| 152 new EasyUnlockUserLoginFlow(user_id)); | 157 new EasyUnlockUserLoginFlow(user_id)); |
| 153 } | 158 } |
| 154 | 159 |
| 155 bool ChromeLoginPerformer::CheckPolicyForUser(const std::string& user_id) { | 160 bool ChromeLoginPerformer::CheckPolicyForUser(const std::string& user_id) { |
| 156 // Login is not allowed if policy could not be loaded for the account. | 161 // Login is not allowed if policy could not be loaded for the account. |
| 157 policy::BrowserPolicyConnectorChromeOS* connector = | 162 policy::BrowserPolicyConnectorChromeOS* connector = |
| 158 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 163 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 159 policy::DeviceLocalAccountPolicyService* policy_service = | 164 policy::DeviceLocalAccountPolicyService* policy_service = |
| 160 connector->GetDeviceLocalAccountPolicyService(); | 165 connector->GetDeviceLocalAccountPolicyService(); |
| 161 return policy_service && policy_service->IsPolicyAvailableForUser(user_id); | 166 return policy_service && policy_service->IsPolicyAvailableForUser(user_id); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 176 const base::Closure& failure_callback, | 181 const base::Closure& failure_callback, |
| 177 policy::WildcardLoginChecker::Result result) { | 182 policy::WildcardLoginChecker::Result result) { |
| 178 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { | 183 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { |
| 179 success_callback.Run(); | 184 success_callback.Run(); |
| 180 } else { | 185 } else { |
| 181 failure_callback.Run(); | 186 failure_callback.Run(); |
| 182 } | 187 } |
| 183 } | 188 } |
| 184 | 189 |
| 185 } // namespace chromeos | 190 } // namespace chromeos |
| OLD | NEW |