| OLD | NEW |
| (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 #ifndef CHROMEOS_LOGIN_AUTH_AUTHPOLICY_LOGIN_HELPER_H_ |
| 6 #define CHROMEOS_LOGIN_AUTH_AUTHPOLICY_LOGIN_HELPER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/files/scoped_file.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chromeos/dbus/auth_policy_client.h" |
| 15 |
| 16 namespace chromeos { |
| 17 |
| 18 // Helper class to use AuthPolicyClient. For Active Directory domain join and |
| 19 // authenticate users this class should be used instead of AuthPolicyClient. |
| 20 // Allows canceling all pending calls and restarting AuthPolicy service. Used |
| 21 // for enrollment and login UI to proper cancel the flows. |
| 22 class CHROMEOS_EXPORT AuthPolicyLoginHelper { |
| 23 public: |
| 24 using AuthCallback = AuthPolicyClient::AuthCallback; |
| 25 using JoinCallback = AuthPolicyClient::JoinCallback; |
| 26 |
| 27 AuthPolicyLoginHelper(); |
| 28 ~AuthPolicyLoginHelper(); |
| 29 |
| 30 // See AuthPolicyClient::JoinAdDomain. |
| 31 void JoinAdDomain(const std::string& machine_name, |
| 32 const std::string& username, |
| 33 const std::string& password, |
| 34 JoinCallback callback); |
| 35 |
| 36 // See AuthPolicyClient::AuthenticateUser. |
| 37 void AuthenticateUser(const std::string& username, |
| 38 const std::string& password, |
| 39 AuthCallback callback); |
| 40 |
| 41 // Cancel pending requests and restarts AuthPolicy service. |
| 42 void CancelRequestsAndRestart(); |
| 43 |
| 44 private: |
| 45 // Called from AuthPolicyClient::JoinAdDomain. |
| 46 void OnJoinCallback(JoinCallback callback, authpolicy::ErrorType error); |
| 47 |
| 48 // Called from AuthPolicyClient::AuthenticateUser. |
| 49 void OnAuthCallback( |
| 50 AuthCallback callback, |
| 51 authpolicy::ErrorType error, |
| 52 const authpolicy::ActiveDirectoryAccountData& account_data); |
| 53 |
| 54 base::WeakPtrFactory<AuthPolicyLoginHelper> weak_factory_; |
| 55 DISALLOW_COPY_AND_ASSIGN(AuthPolicyLoginHelper); |
| 56 }; |
| 57 |
| 58 } // namespace chromeos |
| 59 |
| 60 #endif // CHROMEOS_LOGIN_AUTH_AUTHPOLICY_LOGIN_HELPER_H_ |
| OLD | NEW |