| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(new AuthAttemptState( |
| 559 UserContext(user_manager::USER_TYPE_GUEST, login::GuestAccountId()), | 559 UserContext(user_manager::USER_TYPE_GUEST, |
| 560 user_manager::chromeos::GuestAccountId()), |
| 560 false, // unlock | 561 false, // unlock |
| 561 false, // online_complete | 562 false, // online_complete |
| 562 false)); // user_is_new | 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( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 = use_guest_mount |
| 592 use_guest_mount ? login::GuestAccountId() : app_account_id; | 593 ? user_manager::chromeos::GuestAccountId() |
| 594 : app_account_id; |
| 593 current_state_.reset(new AuthAttemptState( | 595 current_state_.reset(new AuthAttemptState( |
| 594 UserContext(user_manager::USER_TYPE_KIOSK_APP, account_id), | 596 UserContext(user_manager::USER_TYPE_KIOSK_APP, account_id), |
| 595 false, // unlock | 597 false, // unlock |
| 596 false, // online_complete | 598 false, // online_complete |
| 597 false)); // user_is_new | 599 false)); // user_is_new |
| 598 | 600 |
| 599 remove_user_data_on_failure_ = true; | 601 remove_user_data_on_failure_ = true; |
| 600 if (!use_guest_mount) { | 602 if (!use_guest_mount) { |
| 601 MountPublic(current_state_->AsWeakPtr(), | 603 MountPublic(current_state_->AsWeakPtr(), |
| 602 scoped_refptr<CryptohomeAuthenticator>(this), | 604 scoped_refptr<CryptohomeAuthenticator>(this), |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 Resolve(); | 982 Resolve(); |
| 981 } | 983 } |
| 982 | 984 |
| 983 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, | 985 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, |
| 984 bool check_result) { | 986 bool check_result) { |
| 985 owner_is_verified_ = owner_check_finished; | 987 owner_is_verified_ = owner_check_finished; |
| 986 user_can_login_ = check_result; | 988 user_can_login_ = check_result; |
| 987 } | 989 } |
| 988 | 990 |
| 989 } // namespace chromeos | 991 } // namespace chromeos |
| OLD | NEW |