| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "ash/login/lock_screen_controller.h" | 5 #include "ash/login/lock_screen_controller.h" |
| 6 | 6 |
| 7 #include "chromeos/cryptohome/system_salt_getter.h" | 7 #include "chromeos/cryptohome/system_salt_getter.h" |
| 8 #include "chromeos/login/auth/user_context.h" | 8 #include "chromeos/login/auth/user_context.h" |
| 9 | 9 |
| 10 namespace ash { | 10 namespace ash { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 mojom::AuthType auth_type, | 46 mojom::AuthType auth_type, |
| 47 const base::string16& initial_value) { | 47 const base::string16& initial_value) { |
| 48 NOTIMPLEMENTED(); | 48 NOTIMPLEMENTED(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void LockScreenController::LoadUsers(std::unique_ptr<base::ListValue> users, | 51 void LockScreenController::LoadUsers(std::unique_ptr<base::ListValue> users, |
| 52 bool show_guest) { | 52 bool show_guest) { |
| 53 NOTIMPLEMENTED(); | 53 NOTIMPLEMENTED(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void LockScreenController::SetPinEnabledForUser(const AccountId& account_id, |
| 57 bool is_enabled) { |
| 58 NOTIMPLEMENTED(); |
| 59 } |
| 60 |
| 56 void LockScreenController::AuthenticateUser(const AccountId& account_id, | 61 void LockScreenController::AuthenticateUser(const AccountId& account_id, |
| 57 const std::string& password, | 62 const std::string& password, |
| 58 bool authenticated_by_pin) { | 63 bool authenticated_by_pin) { |
| 59 if (!lock_screen_client_) | 64 if (!lock_screen_client_) |
| 60 return; | 65 return; |
| 61 | 66 |
| 62 chromeos::SystemSaltGetter::Get()->GetSystemSalt(base::Bind( | 67 chromeos::SystemSaltGetter::Get()->GetSystemSalt(base::Bind( |
| 63 &LockScreenController::DoAuthenticateUser, base::Unretained(this), | 68 &LockScreenController::DoAuthenticateUser, base::Unretained(this), |
| 64 account_id, password, authenticated_by_pin)); | 69 account_id, password, authenticated_by_pin)); |
| 65 } | 70 } |
| 66 | 71 |
| 67 void LockScreenController::AttemptUnlock(const AccountId& account_id) { | 72 void LockScreenController::AttemptUnlock(const AccountId& account_id) { |
| 68 if (!lock_screen_client_) | 73 if (!lock_screen_client_) |
| 69 return; | 74 return; |
| 70 lock_screen_client_->AttemptUnlock(account_id); | 75 lock_screen_client_->AttemptUnlock(account_id); |
| 71 } | 76 } |
| 72 | 77 |
| 73 void LockScreenController::HardlockPod(const AccountId& account_id) { | 78 void LockScreenController::HardlockPod(const AccountId& account_id) { |
| 74 if (!lock_screen_client_) | 79 if (!lock_screen_client_) |
| 75 return; | 80 return; |
| 76 lock_screen_client_->HardlockPod(account_id); | 81 lock_screen_client_->HardlockPod(account_id); |
| 77 } | 82 } |
| 78 | 83 |
| 79 void LockScreenController::RecordClickOnLockIcon(const AccountId& account_id) { | 84 void LockScreenController::RecordClickOnLockIcon(const AccountId& account_id) { |
| 80 if (!lock_screen_client_) | 85 if (!lock_screen_client_) |
| 81 return; | 86 return; |
| 82 lock_screen_client_->RecordClickOnLockIcon(account_id); | 87 lock_screen_client_->RecordClickOnLockIcon(account_id); |
| 83 } | 88 } |
| 84 | 89 |
| 90 void LockScreenController::FocusPod(const AccountId& account_id) { |
| 91 if (!lock_screen_client_) |
| 92 return; |
| 93 lock_screen_client_->FocusPod(account_id); |
| 94 } |
| 95 |
| 96 void LockScreenController::NoPodFocused() { |
| 97 if (!lock_screen_client_) |
| 98 return; |
| 99 lock_screen_client_->NoPodFocused(); |
| 100 } |
| 101 |
| 102 void LockScreenController::LoadWallpaper(const AccountId& account_id) { |
| 103 if (!lock_screen_client_) |
| 104 return; |
| 105 lock_screen_client_->LoadWallpaper(account_id); |
| 106 } |
| 107 |
| 108 void LockScreenController::SignOutUser() { |
| 109 if (!lock_screen_client_) |
| 110 return; |
| 111 lock_screen_client_->SignOutUser(); |
| 112 } |
| 113 |
| 114 void LockScreenController::MaxIncorrectPasswordAttempts( |
| 115 const AccountId& account_id) { |
| 116 if (!lock_screen_client_) |
| 117 return; |
| 118 lock_screen_client_->MaxIncorrectPasswordAttempts(account_id); |
| 119 } |
| 120 |
| 85 void LockScreenController::DoAuthenticateUser(const AccountId& account_id, | 121 void LockScreenController::DoAuthenticateUser(const AccountId& account_id, |
| 86 const std::string& password, | 122 const std::string& password, |
| 87 bool authenticated_by_pin, | 123 bool authenticated_by_pin, |
| 88 const std::string& system_salt) { | 124 const std::string& system_salt) { |
| 89 // Hash password before sending through mojo. | 125 // Hash password before sending through mojo. |
| 90 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and | 126 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and |
| 91 // a different hash algorithm. Update this part in PinStorage. | 127 // a different hash algorithm. Update this part in PinStorage. |
| 92 chromeos::Key key(password); | 128 chromeos::Key key(password); |
| 93 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); | 129 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); |
| 94 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(), | 130 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(), |
| 95 authenticated_by_pin); | 131 authenticated_by_pin); |
| 96 } | 132 } |
| 97 | 133 |
| 98 } // namespace ash | 134 } // namespace ash |
| OLD | NEW |