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

Unified Diff: ash/login/lock_screen_controller.cc

Issue 2876673002: mojo api for view based lockscreen (Closed)
Patch Set: Incorporate comments from patch set 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/login/lock_screen_controller.h ('k') | ash/login/lock_screen_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/login/lock_screen_controller.cc
diff --git a/ash/login/lock_screen_controller.cc b/ash/login/lock_screen_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5ff835e034049bb50717f77809a1f13da4591d08
--- /dev/null
+++ b/ash/login/lock_screen_controller.cc
@@ -0,0 +1,59 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/login/lock_screen_controller.h"
+
+#include "chromeos/cryptohome/system_salt_getter.h"
+#include "chromeos/login/auth/user_context.h"
+
+namespace ash {
+
+LockScreenController::LockScreenController() = default;
+
+LockScreenController::~LockScreenController() = default;
+
+void LockScreenController::BindRequest(mojom::LockScreenRequest request) {
+ bindings_.AddBinding(this, std::move(request));
+}
+
+void LockScreenController::AuthenticateUser(const AccountId& account_id,
+ const std::string& password,
+ bool authenticated_by_pin) {
+ if (!lock_screen_client_)
+ return;
+
+ chromeos::SystemSaltGetter::Get()->GetSystemSalt(base::Bind(
+ &LockScreenController::DoAuthenticateUser, base::Unretained(this),
+ account_id, password, authenticated_by_pin));
+}
+
+void LockScreenController::SetClient(mojom::LockScreenClientPtr client) {
+ lock_screen_client_ = std::move(client);
+}
+
+void LockScreenController::ShowErrorMessage(int32_t login_attempts,
+ const std::string& error_text,
+ const std::string& help_link_text,
+ int32_t help_topic_id) {
+ NOTIMPLEMENTED();
+}
+
+void LockScreenController::ClearErrors() {
+ NOTIMPLEMENTED();
+}
+
+void LockScreenController::DoAuthenticateUser(const AccountId& account_id,
+ const std::string& password,
+ bool authenticated_by_pin,
+ const std::string& system_salt) {
+ // Hash password before sending through mojo.
+ // TODO(xiaoyinh): Pin is hashed differently by using a different salt and
+ // a different hash algorithm. Update this part in PinStorage.
+ chromeos::Key key(password);
+ key.Transform(chromeos::Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
+ lock_screen_client_->AuthenticateUser(account_id, key.GetSecret(),
+ authenticated_by_pin);
+}
+
+} // namespace ash
« no previous file with comments | « ash/login/lock_screen_controller.h ('k') | ash/login/lock_screen_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698