| 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 "ash/login/ui/lock_screen.h" |
| 7 #include "chromeos/cryptohome/system_salt_getter.h" | 8 #include "chromeos/cryptohome/system_salt_getter.h" |
| 8 #include "chromeos/login/auth/user_context.h" | 9 #include "chromeos/login/auth/user_context.h" |
| 9 | 10 |
| 10 namespace ash { | 11 namespace ash { |
| 11 | 12 |
| 12 LockScreenController::LockScreenController() = default; | 13 LockScreenController::LockScreenController() = default; |
| 13 | 14 |
| 14 LockScreenController::~LockScreenController() = default; | 15 LockScreenController::~LockScreenController() = default; |
| 15 | 16 |
| 16 void LockScreenController::BindRequest(mojom::LockScreenRequest request) { | 17 void LockScreenController::BindRequest(mojom::LockScreenRequest request) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 | 35 |
| 35 void LockScreenController::ShowErrorMessage(int32_t login_attempts, | 36 void LockScreenController::ShowErrorMessage(int32_t login_attempts, |
| 36 const std::string& error_text, | 37 const std::string& error_text, |
| 37 const std::string& help_link_text, | 38 const std::string& help_link_text, |
| 38 int32_t help_topic_id) { | 39 int32_t help_topic_id) { |
| 39 NOTIMPLEMENTED(); | 40 NOTIMPLEMENTED(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void LockScreenController::ClearErrors() { | 43 void LockScreenController::ClearErrors() { |
| 43 NOTIMPLEMENTED(); | 44 NOTIMPLEMENTED(); |
| 45 |
| 46 // TODO: At the moment, we don't have a notification that authentication has |
| 47 // succeeded. ClearErrors is delivered though after login success so we reuse |
| 48 // that. This should be done in a mojo call like AnimateAuthenticationSuccess. |
| 49 DestroyLockScreen(); |
| 44 } | 50 } |
| 45 | 51 |
| 46 void LockScreenController::DoAuthenticateUser(const AccountId& account_id, | 52 void LockScreenController::DoAuthenticateUser(const AccountId& account_id, |
| 47 const std::string& password, | 53 const std::string& password, |
| 48 bool authenticated_by_pin, | 54 bool authenticated_by_pin, |
| 49 const std::string& system_salt) { | 55 const std::string& system_salt) { |
| 50 // Hash password before sending through mojo. | 56 // Hash password before sending through mojo. |
| 51 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and | 57 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and |
| 52 // a different hash algorithm. Update this part in PinStorage. | 58 // a different hash algorithm. Update this part in PinStorage. |
| 53 chromeos::Key key(password); | 59 chromeos::Key key(password); |
| 54 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); | 60 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); |
| 55 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(), | 61 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(), |
| 56 authenticated_by_pin); | 62 authenticated_by_pin); |
| 57 } | 63 } |
| 58 | 64 |
| 59 } // namespace ash | 65 } // namespace ash |
| OLD | NEW |