| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/dbus/fake_auth_policy_client.h" | 5 #include "chromeos/dbus/fake_auth_policy_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void FakeAuthPolicyClient::AuthenticateUser( | 106 void FakeAuthPolicyClient::AuthenticateUser( |
| 107 const std::string& user_principal_name, | 107 const std::string& user_principal_name, |
| 108 int password_fd, | 108 int password_fd, |
| 109 const AuthCallback& callback) { | 109 const AuthCallback& callback) { |
| 110 authpolicy::ActiveDirectoryAccountData account_data; | 110 authpolicy::ActiveDirectoryAccountData account_data; |
| 111 if (!started_) { | 111 if (!started_) { |
| 112 LOG(ERROR) << "authpolicyd not started"; | 112 LOG(ERROR) << "authpolicyd not started"; |
| 113 callback.Run(authpolicy::ERROR_DBUS_FAILURE, account_data); | 113 callback.Run(authpolicy::ERROR_DBUS_FAILURE, account_data); |
| 114 return; | 114 return; |
| 115 } | 115 } |
| 116 account_data.set_account_id(base::MD5String(user_principal_name)); | 116 if (auth_error_ == authpolicy::ERROR_NONE) |
| 117 callback.Run(authpolicy::ERROR_NONE, account_data); | 117 account_data.set_account_id(base::MD5String(user_principal_name)); |
| 118 callback.Run(auth_error_, account_data); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void FakeAuthPolicyClient::RefreshDevicePolicy( | 121 void FakeAuthPolicyClient::RefreshDevicePolicy( |
| 121 const RefreshPolicyCallback& callback) { | 122 const RefreshPolicyCallback& callback) { |
| 122 if (!started_) { | 123 if (!started_) { |
| 123 LOG(ERROR) << "authpolicyd not started"; | 124 LOG(ERROR) << "authpolicyd not started"; |
| 124 callback.Run(false); | 125 callback.Run(false); |
| 125 return; | 126 return; |
| 126 } | 127 } |
| 127 base::FilePath policy_path; | 128 base::FilePath policy_path; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 .WithShutdownBehavior( | 177 .WithShutdownBehavior( |
| 177 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) | 178 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) |
| 178 .WithPriority(base::TaskPriority::BACKGROUND) | 179 .WithPriority(base::TaskPriority::BACKGROUND) |
| 179 .MayBlock(), | 180 .MayBlock(), |
| 180 base::Bind(&WritePolicyFile, policy_path, payload, | 181 base::Bind(&WritePolicyFile, policy_path, payload, |
| 181 "google/chromeos/user"), | 182 "google/chromeos/user"), |
| 182 callback); | 183 callback); |
| 183 } | 184 } |
| 184 | 185 |
| 185 } // namespace chromeos | 186 } // namespace chromeos |
| OLD | NEW |