Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: ash/login/lock_screen_controller.cc

Issue 2876673002: mojo api for view based lockscreen (Closed)
Patch Set: Add a TODO and rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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() = default;
13
14 LockScreenController::~LockScreenController() = default;
15
16 void LockScreenController::BindRequest(mojom::LockScreenRequest request) {
17 bindings_.AddBinding(this, std::move(request));
18 }
19
20 void LockScreenController::AuthenticateUser(const AccountId& account_id,
21 const std::string& password,
22 bool authenticated_by_pin) {
23 chromeos::SystemSaltGetter::Get()->GetSystemSalt(base::Bind(
24 &LockScreenController::DoAuthenticateUser, base::Unretained(this),
25 account_id, password, authenticated_by_pin));
26 }
27
28 void LockScreenController::SetClient(mojom::LockScreenClientPtr client) {
29 lock_screen_client_ = std::move(client);
30 }
31
32 void LockScreenController::ShowErrorMessage(int32_t login_attempts,
33 const std::string& error_text,
34 const std::string& help_link_text,
35 int32_t help_topic_id) {
36 NOTIMPLEMENTED();
37 }
38
39 void LockScreenController::ClearErrors() {
40 NOTIMPLEMENTED();
41 }
42
43 void LockScreenController::DoAuthenticateUser(const AccountId& account_id,
44 const std::string& password,
45 bool authenticated_by_pin,
46 const std::string& system_salt) {
47 // Hash password before sending through mojo.
48 // TODO(xiaoyinh): Pin is hashed differently by using a different salt and
49 // a different hash algorithm. Update this part in PinStorage.
50 chromeos::Key key(password);
51 key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
52 if (lock_screen_client_) {
jdufault 2017/05/17 20:38:22 nit: invert and do an early return if no lock_scre
xiaoyinh(OOO Sep 11-29) 2017/05/18 17:33:50 Done.
53 lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(),
54 authenticated_by_pin);
55 }
56 }
57
58 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698