Chromium Code Reviews| 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 (new policy::WildcardLoginChecker())->Start( | |
|
Joao da Silva
2014/01/28 14:45:46
I've found code like this hard to get right in tes
Mattias Nissler (ping if slow)
2014/01/28 15:44:22
All right, converting.
| |
| 179 ProfileHelper::GetSigninProfile()->GetRequestContext(), | |
| 180 base::Bind(&LoginPerformer::OnlineWildcardLoginCheckCompleted, | |
| 181 weak_factory_.GetWeakPtr())); | |
| 182 } else { | |
| 183 StartLoginCompletion(); | |
| 184 } | |
| 171 break; | 185 break; |
| 186 } | |
| 172 case AUTH_MODE_INTERNAL: | 187 case AUTH_MODE_INTERNAL: |
| 173 StartAuthentication(); | 188 StartAuthentication(); |
| 174 break; | 189 break; |
| 175 } | 190 } |
| 176 } else { | 191 } else { |
| 177 if (delegate_) | 192 if (delegate_) |
| 178 delegate_->WhiteListCheckFailed(user_context.username); | 193 delegate_->WhiteListCheckFailed(user_context.username); |
| 179 else | 194 else |
| 180 NOTREACHED(); | 195 NOTREACHED(); |
| 181 } | 196 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 // Make unobtrusive online check. It helps to determine password change | 349 // Make unobtrusive online check. It helps to determine password change |
| 335 // state in the case when offline login fails. | 350 // state in the case when offline login fails. |
| 336 online_attempt_host_.Check(profile, user_context_); | 351 online_attempt_host_.Check(profile, user_context_); |
| 337 } else { | 352 } else { |
| 338 NOTREACHED(); | 353 NOTREACHED(); |
| 339 } | 354 } |
| 340 user_context_.password.clear(); | 355 user_context_.password.clear(); |
| 341 user_context_.auth_code.clear(); | 356 user_context_.auth_code.clear(); |
| 342 } | 357 } |
| 343 | 358 |
| 359 void LoginPerformer::OnlineWildcardLoginCheckCompleted(bool result) { | |
| 360 if (result) { | |
| 361 StartLoginCompletion(); | |
| 362 } else { | |
| 363 if (delegate_) | |
| 364 delegate_->WhiteListCheckFailed(user_context_.username); | |
| 365 } | |
| 366 } | |
| 344 } // namespace chromeos | 367 } // namespace chromeos |
|
Joao da Silva
2014/01/28 14:45:46
nit: add a newline
Mattias Nissler (ping if slow)
2014/01/28 15:44:22
Done.
| |
| OLD | NEW |