| 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/supervised_user_authentication.h
" | 20 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" |
| 21 #include "chrome/browser/chromeos/login/managed/supervised_user_login_flow.h" | 21 #include "chrome/browser/chromeos/login/managed/supervised_user_login_flow.h" |
| 22 #include "chrome/browser/chromeos/login/supervised_user_manager.h" | 22 #include "chrome/browser/chromeos/login/supervised_user_manager.h" |
| 23 #include "chrome/browser/chromeos/login/user_manager.h" | 23 #include "chrome/browser/chromeos/login/user_manager.h" |
| 24 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 24 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 25 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 25 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
| 26 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" |
| 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 27 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 27 #include "chrome/browser/chromeos/settings/cros_settings.h" | 28 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 29 #include "chromeos/dbus/dbus_thread_manager.h" | 30 #include "chromeos/dbus/dbus_thread_manager.h" |
| 30 #include "chromeos/dbus/session_manager_client.h" | 31 #include "chromeos/dbus/session_manager_client.h" |
| 31 #include "chromeos/settings/cros_settings_names.h" | 32 #include "chromeos/settings/cros_settings_names.h" |
| 32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 34 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
| 35 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 delegate_->PolicyLoadFailed(); | 156 delegate_->PolicyLoadFailed(); |
| 156 else | 157 else |
| 157 NOTREACHED(); | 158 NOTREACHED(); |
| 158 return; | 159 return; |
| 159 } else if (status != CrosSettingsProvider::TRUSTED) { | 160 } else if (status != CrosSettingsProvider::TRUSTED) { |
| 160 // Value of AllowNewUser setting is still not verified. | 161 // Value of AllowNewUser setting is still not verified. |
| 161 // Another attempt will be invoked after verification completion. | 162 // Another attempt will be invoked after verification completion. |
| 162 return; | 163 return; |
| 163 } | 164 } |
| 164 | 165 |
| 165 bool is_whitelisted = LoginUtils::IsWhitelisted( | 166 bool wildcard_match = false; |
| 166 gaia::CanonicalizeEmail(user_context.username)); | 167 std::string email = gaia::CanonicalizeEmail(user_context.username); |
| 168 bool is_whitelisted = LoginUtils::IsWhitelisted(email, &wildcard_match); |
| 167 if (is_whitelisted) { | 169 if (is_whitelisted) { |
| 168 switch (auth_mode_) { | 170 switch (auth_mode_) { |
| 169 case AUTH_MODE_EXTENSION: | 171 case AUTH_MODE_EXTENSION: { |
| 170 StartLoginCompletion(); | 172 // On enterprise devices, reconfirm login permission with the server. |
| 173 policy::BrowserPolicyConnectorChromeOS* connector = |
| 174 g_browser_process->platform_part() |
| 175 ->browser_policy_connector_chromeos(); |
| 176 if (connector->IsEnterpriseManaged() && wildcard_match && |
| 177 !connector->IsNonEnterpriseUser(email)) { |
| 178 wildcard_login_checker_.reset(new policy::WildcardLoginChecker()); |
| 179 wildcard_login_checker_->Start( |
| 180 ProfileHelper::GetSigninProfile()->GetRequestContext(), |
| 181 base::Bind(&LoginPerformer::OnlineWildcardLoginCheckCompleted, |
| 182 weak_factory_.GetWeakPtr())); |
| 183 } else { |
| 184 StartLoginCompletion(); |
| 185 } |
| 171 break; | 186 break; |
| 187 } |
| 172 case AUTH_MODE_INTERNAL: | 188 case AUTH_MODE_INTERNAL: |
| 173 StartAuthentication(); | 189 StartAuthentication(); |
| 174 break; | 190 break; |
| 175 } | 191 } |
| 176 } else { | 192 } else { |
| 177 if (delegate_) | 193 if (delegate_) |
| 178 delegate_->WhiteListCheckFailed(user_context.username); | 194 delegate_->WhiteListCheckFailed(user_context.username); |
| 179 else | 195 else |
| 180 NOTREACHED(); | 196 NOTREACHED(); |
| 181 } | 197 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 // Make unobtrusive online check. It helps to determine password change | 350 // Make unobtrusive online check. It helps to determine password change |
| 335 // state in the case when offline login fails. | 351 // state in the case when offline login fails. |
| 336 online_attempt_host_.Check(profile, user_context_); | 352 online_attempt_host_.Check(profile, user_context_); |
| 337 } else { | 353 } else { |
| 338 NOTREACHED(); | 354 NOTREACHED(); |
| 339 } | 355 } |
| 340 user_context_.password.clear(); | 356 user_context_.password.clear(); |
| 341 user_context_.auth_code.clear(); | 357 user_context_.auth_code.clear(); |
| 342 } | 358 } |
| 343 | 359 |
| 360 void LoginPerformer::OnlineWildcardLoginCheckCompleted(bool result) { |
| 361 if (result) { |
| 362 StartLoginCompletion(); |
| 363 } else { |
| 364 if (delegate_) |
| 365 delegate_->WhiteListCheckFailed(user_context_.username); |
| 366 } |
| 367 } |
| 368 |
| 344 } // namespace chromeos | 369 } // namespace chromeos |
| OLD | NEW |