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

Side by Side Diff: chromeos/login/auth/authpolicy_login_helper.cc

Issue 2835473002: Chromad: Allow offline login. (Closed)
Patch Set: Created 3 years, 8 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
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 "chromeos/login/auth/authpolicy_login_helper.h" 5 #include "chromeos/login/auth/authpolicy_login_helper.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/task_scheduler/post_task.h" 8 #include "base/task_scheduler/post_task.h"
9 #include "chromeos/dbus/auth_policy_client.h" 9 #include "chromeos/dbus/auth_policy_client.h"
10 #include "chromeos/dbus/dbus_thread_manager.h" 10 #include "chromeos/dbus/dbus_thread_manager.h"
(...skipping 28 matching lines...) Expand all
39 const std::string& password, 39 const std::string& password,
40 JoinCallback callback) { 40 JoinCallback callback) {
41 DCHECK(!weak_factory_.HasWeakPtrs()) << "Another operation is in progress"; 41 DCHECK(!weak_factory_.HasWeakPtrs()) << "Another operation is in progress";
42 chromeos::DBusThreadManager::Get()->GetAuthPolicyClient()->JoinAdDomain( 42 chromeos::DBusThreadManager::Get()->GetAuthPolicyClient()->JoinAdDomain(
43 machine_name, username, GetDataReadPipe(password).get(), 43 machine_name, username, GetDataReadPipe(password).get(),
44 base::BindOnce(&AuthPolicyLoginHelper::OnJoinCallback, 44 base::BindOnce(&AuthPolicyLoginHelper::OnJoinCallback,
45 weak_factory_.GetWeakPtr(), base::Passed(&callback))); 45 weak_factory_.GetWeakPtr(), base::Passed(&callback)));
46 } 46 }
47 47
48 void AuthPolicyLoginHelper::AuthenticateUser(const std::string& username, 48 void AuthPolicyLoginHelper::AuthenticateUser(const std::string& username,
49 const std::string& object_guid,
49 const std::string& password, 50 const std::string& password,
50 AuthCallback callback) { 51 AuthCallback callback) {
51 DCHECK(!weak_factory_.HasWeakPtrs()) << "Another operation is in progress"; 52 DCHECK(!weak_factory_.HasWeakPtrs()) << "Another operation is in progress";
52 chromeos::DBusThreadManager::Get()->GetAuthPolicyClient()->AuthenticateUser( 53 chromeos::DBusThreadManager::Get()->GetAuthPolicyClient()->AuthenticateUser(
53 username, GetDataReadPipe(password).get(), 54 username, object_guid, GetDataReadPipe(password).get(),
54 base::BindOnce(&AuthPolicyLoginHelper::OnAuthCallback, 55 base::BindOnce(&AuthPolicyLoginHelper::OnAuthCallback,
55 weak_factory_.GetWeakPtr(), base::Passed(&callback))); 56 weak_factory_.GetWeakPtr(), base::Passed(&callback)));
56 } 57 }
57 58
58 void AuthPolicyLoginHelper::CancelRequestsAndRestart() { 59 void AuthPolicyLoginHelper::CancelRequestsAndRestart() {
59 weak_factory_.InvalidateWeakPtrs(); 60 weak_factory_.InvalidateWeakPtrs();
60 chromeos::DBusThreadManager::Get() 61 chromeos::DBusThreadManager::Get()
61 ->GetUpstartClient() 62 ->GetUpstartClient()
62 ->RestartAuthPolicyService(); 63 ->RestartAuthPolicyService();
63 } 64 }
64 65
65 void AuthPolicyLoginHelper::OnJoinCallback(JoinCallback callback, 66 void AuthPolicyLoginHelper::OnJoinCallback(JoinCallback callback,
66 authpolicy::ErrorType error) { 67 authpolicy::ErrorType error) {
67 std::move(callback).Run(error); 68 std::move(callback).Run(error);
68 } 69 }
69 70
70 void AuthPolicyLoginHelper::OnAuthCallback( 71 void AuthPolicyLoginHelper::OnAuthCallback(
71 AuthCallback callback, 72 AuthCallback callback,
72 authpolicy::ErrorType error, 73 authpolicy::ErrorType error,
73 const authpolicy::ActiveDirectoryAccountData& account_data) { 74 const authpolicy::ActiveDirectoryAccountData& account_data) {
74 std::move(callback).Run(error, account_data); 75 std::move(callback).Run(error, account_data);
75 } 76 }
76 77
77 AuthPolicyLoginHelper::~AuthPolicyLoginHelper() {} 78 AuthPolicyLoginHelper::~AuthPolicyLoginHelper() {}
78 79
79 } // namespace chromeos 80 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698