| 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 "ash/login/ui/lock_screen.h" |
| 8 #include "chromeos/cryptohome/system_salt_getter.h" | 8 #include "chromeos/cryptohome/system_salt_getter.h" |
| 9 #include "chromeos/login/auth/user_context.h" | 9 #include "chromeos/login/auth/user_context.h" |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 mojom::AuthType auth_type, | 52 mojom::AuthType auth_type, |
| 53 const base::string16& initial_value) { | 53 const base::string16& initial_value) { |
| 54 NOTIMPLEMENTED(); | 54 NOTIMPLEMENTED(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void LockScreenController::LoadUsers(std::unique_ptr<base::ListValue> users, | 57 void LockScreenController::LoadUsers(std::unique_ptr<base::ListValue> users, |
| 58 bool show_guest) { | 58 bool show_guest) { |
| 59 NOTIMPLEMENTED(); | 59 NOTIMPLEMENTED(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void LockScreenController::SetPinEnabledForUser(const AccountId& account_id, |
| 63 bool is_enabled) { |
| 64 NOTIMPLEMENTED(); |
| 65 } |
| 66 |
| 62 void LockScreenController::AuthenticateUser( | 67 void LockScreenController::AuthenticateUser( |
| 63 const AccountId& account_id, | 68 const AccountId& account_id, |
| 64 const std::string& password, | 69 const std::string& password, |
| 65 bool authenticated_by_pin, | 70 bool authenticated_by_pin, |
| 66 mojom::LockScreenClient::AuthenticateUserCallback callback) { | 71 mojom::LockScreenClient::AuthenticateUserCallback callback) { |
| 67 if (!lock_screen_client_) | 72 if (!lock_screen_client_) |
| 68 return; | 73 return; |
| 69 | 74 |
| 70 // We cannot execute auth requests directly via GetSystemSalt because it | 75 // We cannot execute auth requests directly via GetSystemSalt because it |
| 71 // expects a base::Callback instance, but |callback| is a base::OnceCallback. | 76 // expects a base::Callback instance, but |callback| is a base::OnceCallback. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 90 return; | 95 return; |
| 91 lock_screen_client_->HardlockPod(account_id); | 96 lock_screen_client_->HardlockPod(account_id); |
| 92 } | 97 } |
| 93 | 98 |
| 94 void LockScreenController::RecordClickOnLockIcon(const AccountId& account_id) { | 99 void LockScreenController::RecordClickOnLockIcon(const AccountId& account_id) { |
| 95 if (!lock_screen_client_) | 100 if (!lock_screen_client_) |
| 96 return; | 101 return; |
| 97 lock_screen_client_->RecordClickOnLockIcon(account_id); | 102 lock_screen_client_->RecordClickOnLockIcon(account_id); |
| 98 } | 103 } |
| 99 | 104 |
| 105 void LockScreenController::OnFocusPod(const AccountId& account_id) { |
| 106 if (!lock_screen_client_) |
| 107 return; |
| 108 lock_screen_client_->OnFocusPod(account_id); |
| 109 } |
| 110 |
| 111 void LockScreenController::OnNoPodFocused() { |
| 112 if (!lock_screen_client_) |
| 113 return; |
| 114 lock_screen_client_->OnNoPodFocused(); |
| 115 } |
| 116 |
| 117 void LockScreenController::LoadWallpaper(const AccountId& account_id) { |
| 118 if (!lock_screen_client_) |
| 119 return; |
| 120 lock_screen_client_->LoadWallpaper(account_id); |
| 121 } |
| 122 |
| 123 void LockScreenController::SignOutUser() { |
| 124 if (!lock_screen_client_) |
| 125 return; |
| 126 lock_screen_client_->SignOutUser(); |
| 127 } |
| 128 |
| 129 void LockScreenController::OnMaxIncorrectPasswordAttempted( |
| 130 const AccountId& account_id) { |
| 131 if (!lock_screen_client_) |
| 132 return; |
| 133 lock_screen_client_->OnMaxIncorrectPasswordAttempted(account_id); |
| 134 } |
| 135 |
| 100 void LockScreenController::DoAuthenticateUser( | 136 void LockScreenController::DoAuthenticateUser( |
| 101 const AccountId& account_id, | 137 const AccountId& account_id, |
| 102 const std::string& password, | 138 const std::string& password, |
| 103 bool authenticated_by_pin, | 139 bool authenticated_by_pin, |
| 104 mojom::LockScreenClient::AuthenticateUserCallback callback, | 140 mojom::LockScreenClient::AuthenticateUserCallback callback, |
| 105 const std::string& system_salt) { | 141 const std::string& system_salt) { |
| 106 // Hash password before sending through mojo. | 142 // Hash password before sending through mojo. |
| 107 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and | 143 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and |
| 108 // a different hash algorithm. Update this part in PinStorage. | 144 // a different hash algorithm. Update this part in PinStorage. |
| 109 chromeos::Key key(password); | 145 chromeos::Key key(password); |
| 110 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); | 146 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); |
| 111 lock_screen_client_->AuthenticateUser( | 147 lock_screen_client_->AuthenticateUser( |
| 112 account_id, key.GetSecret(), authenticated_by_pin, std::move(callback)); | 148 account_id, key.GetSecret(), authenticated_by_pin, std::move(callback)); |
| 113 } | 149 } |
| 114 | 150 |
| 115 void LockScreenController::OnGetSystemSalt(const std::string& system_salt) { | 151 void LockScreenController::OnGetSystemSalt(const std::string& system_salt) { |
| 116 std::move(pending_user_auth_).Run(system_salt); | 152 std::move(pending_user_auth_).Run(system_salt); |
| 117 } | 153 } |
| 118 | 154 |
| 119 } // namespace ash | 155 } // namespace ash |
| OLD | NEW |