| 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/login_utils.h" | 11 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 12 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 12 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 13 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" | 13 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" |
| 14 #include "chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h" | 14 #include "chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h" |
| 15 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 15 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 16 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 16 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 18 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 18 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 20 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 21 | 21 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Another attempt will be invoked after verification completion. | 78 // Another attempt will be invoked after verification completion. |
| 79 return; | 79 return; |
| 80 } else { | 80 } else { |
| 81 DCHECK(status == CrosSettingsProvider::TRUSTED); | 81 DCHECK(status == CrosSettingsProvider::TRUSTED); |
| 82 callback.Run(); | 82 callback.Run(); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool ChromeLoginPerformer::IsUserWhitelisted(const std::string& user_id, | 86 bool ChromeLoginPerformer::IsUserWhitelisted(const std::string& user_id, |
| 87 bool* wildcard_match) { | 87 bool* wildcard_match) { |
| 88 return LoginUtils::IsWhitelisted(user_id, wildcard_match); | 88 return CrosSettings::IsWhitelisted(user_id, wildcard_match); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ChromeLoginPerformer::RunOnlineWhitelistCheck( | 91 void ChromeLoginPerformer::RunOnlineWhitelistCheck( |
| 92 const std::string& user_id, | 92 const std::string& user_id, |
| 93 bool wildcard_match, | 93 bool wildcard_match, |
| 94 const base::Closure& success_callback, | 94 const base::Closure& success_callback, |
| 95 const base::Closure& failure_callback) { | 95 const base::Closure& failure_callback) { |
| 96 // On enterprise devices, reconfirm login permission with the server. | 96 // On enterprise devices, reconfirm login permission with the server. |
| 97 policy::BrowserPolicyConnectorChromeOS* connector = | 97 policy::BrowserPolicyConnectorChromeOS* connector = |
| 98 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 98 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 99 if (connector->IsEnterpriseManaged() && wildcard_match && | 99 if (connector->IsEnterpriseManaged() && wildcard_match && |
| 100 !connector->IsNonEnterpriseUser(user_id)) { | 100 !connector->IsNonEnterpriseUser(user_id)) { |
| 101 wildcard_login_checker_.reset(new policy::WildcardLoginChecker()); | 101 wildcard_login_checker_.reset(new policy::WildcardLoginChecker()); |
| 102 wildcard_login_checker_->Start( | 102 wildcard_login_checker_->Start( |
| 103 ProfileHelper::GetSigninProfile()->GetRequestContext(), | 103 ProfileHelper::GetSigninProfile()->GetRequestContext(), |
| 104 base::Bind(&ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted, | 104 base::Bind(&ChromeLoginPerformer::OnlineWildcardLoginCheckCompleted, |
| 105 weak_factory_.GetWeakPtr(), | 105 weak_factory_.GetWeakPtr(), |
| 106 success_callback, | 106 success_callback, |
| 107 failure_callback)); | 107 failure_callback)); |
| 108 } else { | 108 } else { |
| 109 success_callback.Run(); | 109 success_callback.Run(); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 scoped_refptr<Authenticator> ChromeLoginPerformer::CreateAuthenticator() { | 113 scoped_refptr<Authenticator> ChromeLoginPerformer::CreateAuthenticator() { |
| 114 return LoginUtils::Get()->CreateAuthenticator(this); | 114 return UserSessionManager::GetInstance()->CreateAuthenticator(this); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { | 117 bool ChromeLoginPerformer::AreSupervisedUsersAllowed() { |
| 118 return user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); | 118 return user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool ChromeLoginPerformer::UseExtendedAuthenticatorForSupervisedUser( | 121 bool ChromeLoginPerformer::UseExtendedAuthenticatorForSupervisedUser( |
| 122 const UserContext& user_context) { | 122 const UserContext& user_context) { |
| 123 SupervisedUserAuthentication* authentication = | 123 SupervisedUserAuthentication* authentication = |
| 124 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 124 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 const base::Closure& failure_callback, | 168 const base::Closure& failure_callback, |
| 169 policy::WildcardLoginChecker::Result result) { | 169 policy::WildcardLoginChecker::Result result) { |
| 170 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { | 170 if (result == policy::WildcardLoginChecker::RESULT_ALLOWED) { |
| 171 success_callback.Run(); | 171 success_callback.Run(); |
| 172 } else { | 172 } else { |
| 173 failure_callback.Run(); | 173 failure_callback.Run(); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace chromeos | 177 } // namespace chromeos |
| OLD | NEW |