Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/login/lock_screen_controller.h" | |
| 6 | |
| 7 #include "chromeos/cryptohome/system_salt_getter.h" | |
| 8 #include "chromeos/login/auth/user_context.h" | |
| 9 | |
| 10 namespace ash { | |
| 11 | |
| 12 LockScreenController::LockScreenController() { | |
| 13 chromeos::SystemSaltGetter::Get()->GetSystemSalt(base::Bind( | |
| 14 &LockScreenController::OnSaltObtained, base::Unretained(this))); | |
| 15 } | |
| 16 | |
| 17 LockScreenController::~LockScreenController() {} | |
| 18 | |
| 19 void LockScreenController::BindRequest(mojom::LockScreenRequest request) { | |
| 20 bindings_.AddBinding(this, std::move(request)); | |
| 21 } | |
| 22 | |
| 23 void LockScreenController::AuthenticateUser(const AccountId& account_id, | |
| 24 const std::string& password, | |
| 25 bool authenticated_by_pin) { | |
| 26 // Hash password before sending through mojo. | |
|
jdufault
2017/05/13 00:57:40
Instead of caching system_salt_ you can call throu
xiaoyinh(OOO Sep 11-29)
2017/05/15 20:13:05
Good point, thanks! I keep the caching part with t
| |
| 27 chromeos::UserContext user_context(account_id); | |
| 28 chromeos::Key key(password); | |
|
jdufault
2017/05/13 00:57:39
Unfortunately PIN is hashed differently. See [1].
xiaoyinh(OOO Sep 11-29)
2017/05/15 20:13:05
Added a TODO. Thanks for the information.
| |
| 29 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt_); | |
| 30 if (lock_screen_client_) { | |
| 31 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(), | |
| 32 authenticated_by_pin); | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 void LockScreenController::SetClient(mojom::LockScreenClientPtr client) { | |
| 37 lock_screen_client_ = std::move(client); | |
| 38 } | |
| 39 | |
| 40 void LockScreenController::ShowErrorMessage() { | |
| 41 NOTIMPLEMENTED(); | |
| 42 } | |
| 43 | |
| 44 void LockScreenController::ClearErrors() { | |
| 45 NOTIMPLEMENTED(); | |
| 46 } | |
| 47 | |
| 48 void LockScreenController::OnSaltObtained(const std::string& system_salt) { | |
| 49 system_salt_ = system_salt; | |
| 50 } | |
| 51 | |
| 52 } // namespace ash | |
| OLD | NEW |