Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 2835473002: Chromad: Allow offline login. (Closed)
Patch Set: Add TryAuthenticateUser call Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" 50 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" 51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
52 #include "chrome/common/channel_info.h" 52 #include "chrome/common/channel_info.h"
53 #include "chrome/common/chrome_switches.h" 53 #include "chrome/common/chrome_switches.h"
54 #include "chrome/common/url_constants.h" 54 #include "chrome/common/url_constants.h"
55 #include "chrome/grit/generated_resources.h" 55 #include "chrome/grit/generated_resources.h"
56 #include "chromeos/chromeos_switches.h" 56 #include "chromeos/chromeos_switches.h"
57 #include "chromeos/dbus/dbus_thread_manager.h" 57 #include "chromeos/dbus/dbus_thread_manager.h"
58 #include "chromeos/dbus/power_manager_client.h" 58 #include "chromeos/dbus/power_manager_client.h"
59 #include "chromeos/dbus/session_manager_client.h" 59 #include "chromeos/dbus/session_manager_client.h"
60 #include "chromeos/login/auth/authpolicy_login_helper.h"
60 #include "chromeos/settings/cros_settings_names.h" 61 #include "chromeos/settings/cros_settings_names.h"
61 #include "components/arc/arc_util.h" 62 #include "components/arc/arc_util.h"
62 #include "components/google/core/browser/google_util.h" 63 #include "components/google/core/browser/google_util.h"
63 #include "components/policy/core/common/cloud/cloud_policy_core.h" 64 #include "components/policy/core/common/cloud/cloud_policy_core.h"
64 #include "components/policy/core/common/cloud/cloud_policy_store.h" 65 #include "components/policy/core/common/cloud/cloud_policy_store.h"
65 #include "components/policy/core/common/policy_map.h" 66 #include "components/policy/core/common/policy_map.h"
66 #include "components/policy/core/common/policy_service.h" 67 #include "components/policy/core/common/policy_service.h"
67 #include "components/policy/core/common/policy_types.h" 68 #include "components/policy/core/common/policy_types.h"
68 #include "components/policy/policy_constants.h" 69 #include "components/policy/policy_constants.h"
69 #include "components/prefs/pref_service.h" 70 #include "components/prefs/pref_service.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 376 }
376 DCHECK(login_display_.get()); 377 DCHECK(login_display_.get());
377 } 378 }
378 379
379 //////////////////////////////////////////////////////////////////////////////// 380 ////////////////////////////////////////////////////////////////////////////////
380 // ExistingUserController, LoginDisplay::Delegate implementation: 381 // ExistingUserController, LoginDisplay::Delegate implementation:
381 // 382 //
382 383
383 void ExistingUserController::CancelPasswordChangedFlow() { 384 void ExistingUserController::CancelPasswordChangedFlow() {
384 login_performer_.reset(nullptr); 385 login_performer_.reset(nullptr);
386 if (authpolicy_login_helper_)
387 authpolicy_login_helper_->CancelRequestsAndRestart();
385 PerformLoginFinishedActions(true /* start auto login timer */); 388 PerformLoginFinishedActions(true /* start auto login timer */);
386 } 389 }
387 390
388 void ExistingUserController::CompleteLogin(const UserContext& user_context) { 391 void ExistingUserController::CompleteLogin(const UserContext& user_context) {
389 if (!host_) { 392 if (!host_) {
390 // Complete login event was generated already from UI. Ignore notification. 393 // Complete login event was generated already from UI. Ignore notification.
391 return; 394 return;
392 } 395 }
393 396
394 if (is_login_in_progress_) 397 if (is_login_in_progress_)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // Use the same LoginPerformer for subsequent login as it has state 453 // Use the same LoginPerformer for subsequent login as it has state
451 // such as Authenticator instance. 454 // such as Authenticator instance.
452 if (!login_performer_.get() || num_login_attempts_ <= 1) { 455 if (!login_performer_.get() || num_login_attempts_ <= 1) {
453 // Only one instance of LoginPerformer should exist at a time. 456 // Only one instance of LoginPerformer should exist at a time.
454 login_performer_.reset(nullptr); 457 login_performer_.reset(nullptr);
455 login_performer_.reset(new ChromeLoginPerformer(this)); 458 login_performer_.reset(new ChromeLoginPerformer(this));
456 } 459 }
457 policy::BrowserPolicyConnectorChromeOS* connector = 460 policy::BrowserPolicyConnectorChromeOS* connector =
458 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 461 g_browser_process->platform_part()->browser_policy_connector_chromeos();
459 if (connector->IsActiveDirectoryManaged() && 462 if (connector->IsActiveDirectoryManaged() &&
460 user_context.GetAuthFlow() != UserContext::AUTH_FLOW_ACTIVE_DIRECTORY) { 463 user_context.GetUserType() != user_manager::USER_TYPE_ACTIVE_DIRECTORY) {
461 PerformLoginFinishedActions(false /* don't start auto login timer */); 464 PerformLoginFinishedActions(false /* don't start auto login timer */);
462 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED, 465 ShowError(IDS_LOGIN_ERROR_GOOGLE_ACCOUNT_NOT_ALLOWED,
463 "Google accounts are not allowed on this device"); 466 "Google accounts are not allowed on this device");
464 return; 467 return;
465 } 468 }
469 if (user_context.GetAccountId().GetAccountType() ==
470 AccountType::ACTIVE_DIRECTORY) {
471 DCHECK(user_context.GetKey()->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN);
472 if (!authpolicy_login_helper_)
473 authpolicy_login_helper_ = base::MakeUnique<AuthPolicyLoginHelper>();
474 // Try to get kerberos TGT while we have user's password typed on the pod
475 // screen. Failure to get TGT here is OK - that could mean e.g. Active
476 // Directory server is not reachable. We don't want to have user wait for
477 // the Active Directory Authentication on the pod screen. In the follow-up
478 // CL we're gonna create KeyedService inside the user session which would
479 // get status about last authentication and handle possible failures.
480 authpolicy_login_helper_->TryAuthenticateUser(
481 user_context.GetAccountId().GetUserEmail(),
482 user_context.GetAccountId().GetObjGuid(),
483 user_context.GetKey()->GetSecret());
484 }
466 485
467 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) == 486 if (gaia::ExtractDomainName(user_context.GetAccountId().GetUserEmail()) ==
468 user_manager::kSupervisedUserDomain) { 487 user_manager::kSupervisedUserDomain) {
469 login_performer_->LoginAsSupervisedUser(user_context); 488 login_performer_->LoginAsSupervisedUser(user_context);
470 } else { 489 } else {
471 // If a regular user log in to a device which supports ARC, we should make 490 // If a regular user log in to a device which supports ARC, we should make
472 // sure that the user's cryptohome is encrypted in ext4 dircrypto to run the 491 // sure that the user's cryptohome is encrypted in ext4 dircrypto to run the
473 // latest Android runtime. 492 // latest Android runtime.
474 UserContext new_user_context = user_context; 493 UserContext new_user_context = user_context;
475 new_user_context.SetIsForcingDircrypto(ShouldForceDircrypto()); 494 new_user_context.SetIsForcingDircrypto(ShouldForceDircrypto());
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 StartAutoLoginTimer(); 730 StartAutoLoginTimer();
712 } 731 }
713 732
714 // Reset user flow to default, so that special flow will not affect next 733 // Reset user flow to default, so that special flow will not affect next
715 // attempt. 734 // attempt.
716 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_); 735 ChromeUserManager::Get()->ResetUserFlow(last_login_attempt_account_id_);
717 736
718 if (auth_status_consumer_) 737 if (auth_status_consumer_)
719 auth_status_consumer_->OnAuthFailure(failure); 738 auth_status_consumer_->OnAuthFailure(failure);
720 739
740 if (authpolicy_login_helper_)
741 authpolicy_login_helper_->CancelRequestsAndRestart();
721 ClearRecordedNames(); 742 ClearRecordedNames();
722 743
723 // TODO(ginkage): Fix this case once crbug.com/469990 is ready. 744 // TODO(ginkage): Fix this case once crbug.com/469990 is ready.
724 /* 745 /*
725 if (failure.reason() == AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME) { 746 if (failure.reason() == AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME) {
726 RecordReauthReason(last_login_attempt_account_id_, 747 RecordReauthReason(last_login_attempt_account_id_,
727 ReauthReason::MISSING_CRYPTOHOME); 748 ReauthReason::MISSING_CRYPTOHOME);
728 } 749 }
729 */ 750 */
730 } 751 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 void ExistingUserController::WhiteListCheckFailed(const std::string& email) { 900 void ExistingUserController::WhiteListCheckFailed(const std::string& email) {
880 PerformLoginFinishedActions(true /* start auto login timer */); 901 PerformLoginFinishedActions(true /* start auto login timer */);
881 902
882 login_display_->ShowWhitelistCheckFailedError(); 903 login_display_->ShowWhitelistCheckFailedError();
883 904
884 if (auth_status_consumer_) { 905 if (auth_status_consumer_) {
885 auth_status_consumer_->OnAuthFailure( 906 auth_status_consumer_->OnAuthFailure(
886 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED)); 907 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED));
887 } 908 }
888 909
910 if (authpolicy_login_helper_)
911 authpolicy_login_helper_->CancelRequestsAndRestart();
889 ClearRecordedNames(); 912 ClearRecordedNames();
890 } 913 }
891 914
892 void ExistingUserController::PolicyLoadFailed() { 915 void ExistingUserController::PolicyLoadFailed() {
893 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, ""); 916 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, "");
894 917
895 PerformLoginFinishedActions(false /* don't start auto login timer */); 918 PerformLoginFinishedActions(false /* don't start auto login timer */);
919 if (authpolicy_login_helper_)
920 authpolicy_login_helper_->CancelRequestsAndRestart();
896 ClearRecordedNames(); 921 ClearRecordedNames();
897 } 922 }
898 923
899 void ExistingUserController::SetAuthFlowOffline(bool offline) { 924 void ExistingUserController::SetAuthFlowOffline(bool offline) {
900 auth_flow_offline_ = offline; 925 auth_flow_offline_ = offline;
901 } 926 }
902 927
903 //////////////////////////////////////////////////////////////////////////////// 928 ////////////////////////////////////////////////////////////////////////////////
904 // ExistingUserController, private: 929 // ExistingUserController, private:
905 930
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 login_display_->ShowUnrecoverableCrypthomeErrorDialog(); 1473 login_display_->ShowUnrecoverableCrypthomeErrorDialog();
1449 } 1474 }
1450 1475
1451 void ExistingUserController::ClearRecordedNames() { 1476 void ExistingUserController::ClearRecordedNames() {
1452 display_email_.clear(); 1477 display_email_.clear();
1453 display_name_.clear(); 1478 display_name_.clear();
1454 given_name_.clear(); 1479 given_name_.clear();
1455 } 1480 }
1456 1481
1457 } // namespace chromeos 1482 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698