| 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 "chromeos/login/auth/cryptohome_authenticator.h" | 5 #include "chromeos/login/auth/cryptohome_authenticator.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
| 18 #include "chromeos/cryptohome/async_method_caller.h" | 18 #include "chromeos/cryptohome/async_method_caller.h" |
| 19 #include "chromeos/cryptohome/cryptohome_parameters.h" | 19 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 20 #include "chromeos/cryptohome/homedir_methods.h" | 20 #include "chromeos/cryptohome/homedir_methods.h" |
| 21 #include "chromeos/cryptohome/system_salt_getter.h" | 21 #include "chromeos/cryptohome/system_salt_getter.h" |
| 22 #include "chromeos/dbus/cryptohome_client.h" | 22 #include "chromeos/dbus/cryptohome_client.h" |
| 23 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
| 24 #include "chromeos/login/auth/auth_status_consumer.h" | 24 #include "chromeos/login/auth/auth_status_consumer.h" |
| 25 #include "chromeos/login/auth/key.h" | 25 #include "chromeos/login/auth/key.h" |
| 26 #include "chromeos/login/auth/user_context.h" | 26 #include "chromeos/login/auth/user_context.h" |
| 27 #include "chromeos/login/login_state.h" | 27 #include "chromeos/login/login_state.h" |
| 28 #include "chromeos/login/user_names.h" | |
| 29 #include "chromeos/login_event_recorder.h" | 28 #include "chromeos/login_event_recorder.h" |
| 30 #include "components/device_event_log/device_event_log.h" | 29 #include "components/device_event_log/device_event_log.h" |
| 31 #include "components/signin/core/account_id/account_id.h" | 30 #include "components/signin/core/account_id/account_id.h" |
| 32 #include "components/user_manager/known_user.h" | 31 #include "components/user_manager/known_user.h" |
| 32 #include "components/user_manager/user_names.h" |
| 33 #include "components/user_manager/user_type.h" | 33 #include "components/user_manager/user_type.h" |
| 34 #include "third_party/cros_system_api/dbus/service_constants.h" | 34 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 35 | 35 |
| 36 namespace chromeos { | 36 namespace chromeos { |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 // The label used for the key derived from the user's GAIA credentials. | 40 // The label used for the key derived from the user's GAIA credentials. |
| 41 const char kCryptohomeGAIAKeyLabel[] = "gaia"; | 41 const char kCryptohomeGAIAKeyLabel[] = "gaia"; |
| 42 | 42 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 false, // online_complete | 548 false, // online_complete |
| 549 false)); // user_is_new | 549 false)); // user_is_new |
| 550 remove_user_data_on_failure_ = false; | 550 remove_user_data_on_failure_ = false; |
| 551 StartMount(current_state_->AsWeakPtr(), | 551 StartMount(current_state_->AsWeakPtr(), |
| 552 scoped_refptr<CryptohomeAuthenticator>(this), | 552 scoped_refptr<CryptohomeAuthenticator>(this), |
| 553 false /* ephemeral */, false /* create_if_nonexistent */); | 553 false /* ephemeral */, false /* create_if_nonexistent */); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void CryptohomeAuthenticator::LoginOffTheRecord() { | 556 void CryptohomeAuthenticator::LoginOffTheRecord() { |
| 557 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 557 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 558 current_state_.reset(new AuthAttemptState( | 558 current_state_.reset( |
| 559 UserContext(user_manager::USER_TYPE_GUEST, login::GuestAccountId()), | 559 new AuthAttemptState(UserContext(user_manager::USER_TYPE_GUEST, |
| 560 false, // unlock | 560 user_manager::GuestAccountId()), |
| 561 false, // online_complete | 561 false, // unlock |
| 562 false)); // user_is_new | 562 false, // online_complete |
| 563 false)); // user_is_new |
| 563 remove_user_data_on_failure_ = false; | 564 remove_user_data_on_failure_ = false; |
| 564 ephemeral_mount_attempted_ = true; | 565 ephemeral_mount_attempted_ = true; |
| 565 MountGuestAndGetHash(current_state_->AsWeakPtr(), | 566 MountGuestAndGetHash(current_state_->AsWeakPtr(), |
| 566 scoped_refptr<CryptohomeAuthenticator>(this)); | 567 scoped_refptr<CryptohomeAuthenticator>(this)); |
| 567 } | 568 } |
| 568 | 569 |
| 569 void CryptohomeAuthenticator::LoginAsPublicSession( | 570 void CryptohomeAuthenticator::LoginAsPublicSession( |
| 570 const UserContext& user_context) { | 571 const UserContext& user_context) { |
| 571 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 572 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 572 DCHECK_EQ(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user_context.GetUserType()); | 573 DCHECK_EQ(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user_context.GetUserType()); |
| 573 | 574 |
| 574 current_state_.reset( | 575 current_state_.reset( |
| 575 new AuthAttemptState(user_context, | 576 new AuthAttemptState(user_context, |
| 576 false, // unlock | 577 false, // unlock |
| 577 false, // online_complete | 578 false, // online_complete |
| 578 false)); // user_is_new | 579 false)); // user_is_new |
| 579 remove_user_data_on_failure_ = false; | 580 remove_user_data_on_failure_ = false; |
| 580 ephemeral_mount_attempted_ = true; | 581 ephemeral_mount_attempted_ = true; |
| 581 StartMount(current_state_->AsWeakPtr(), | 582 StartMount(current_state_->AsWeakPtr(), |
| 582 scoped_refptr<CryptohomeAuthenticator>(this), true /* ephemeral */, | 583 scoped_refptr<CryptohomeAuthenticator>(this), true /* ephemeral */, |
| 583 true /* create_if_nonexistent */); | 584 true /* create_if_nonexistent */); |
| 584 } | 585 } |
| 585 | 586 |
| 586 void CryptohomeAuthenticator::LoginAsKioskAccount( | 587 void CryptohomeAuthenticator::LoginAsKioskAccount( |
| 587 const AccountId& app_account_id, | 588 const AccountId& app_account_id, |
| 588 bool use_guest_mount) { | 589 bool use_guest_mount) { |
| 589 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 590 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 590 | 591 |
| 591 const AccountId& account_id = | 592 const AccountId& account_id = |
| 592 use_guest_mount ? login::GuestAccountId() : app_account_id; | 593 use_guest_mount ? user_manager::GuestAccountId() : app_account_id; |
| 593 current_state_.reset(new AuthAttemptState( | 594 current_state_.reset(new AuthAttemptState( |
| 594 UserContext(user_manager::USER_TYPE_KIOSK_APP, account_id), | 595 UserContext(user_manager::USER_TYPE_KIOSK_APP, account_id), |
| 595 false, // unlock | 596 false, // unlock |
| 596 false, // online_complete | 597 false, // online_complete |
| 597 false)); // user_is_new | 598 false)); // user_is_new |
| 598 | 599 |
| 599 remove_user_data_on_failure_ = true; | 600 remove_user_data_on_failure_ = true; |
| 600 if (!use_guest_mount) { | 601 if (!use_guest_mount) { |
| 601 MountPublic(current_state_->AsWeakPtr(), | 602 MountPublic(current_state_->AsWeakPtr(), |
| 602 scoped_refptr<CryptohomeAuthenticator>(this), | 603 scoped_refptr<CryptohomeAuthenticator>(this), |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 Resolve(); | 981 Resolve(); |
| 981 } | 982 } |
| 982 | 983 |
| 983 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, | 984 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, |
| 984 bool check_result) { | 985 bool check_result) { |
| 985 owner_is_verified_ = owner_check_finished; | 986 owner_is_verified_ = owner_check_finished; |
| 986 user_can_login_ = check_result; | 987 user_can_login_ = check_result; |
| 987 } | 988 } |
| 988 | 989 |
| 989 } // namespace chromeos | 990 } // namespace chromeos |
| OLD | NEW |