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 #ifndef CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
6 #define CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | 6 #define CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
12 #include "chromeos/dbus/authpolicy/active_directory_account_data.pb.h" | 12 #include "chromeos/dbus/authpolicy/active_directory_info.pb.h" |
13 #include "chromeos/dbus/dbus_client.h" | 13 #include "chromeos/dbus/dbus_client.h" |
14 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
15 | 15 |
16 class AccountId; | 16 class AccountId; |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 | 19 |
20 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy | 20 // AuthPolicyClient is used to communicate with the org.chromium.AuthPolicy |
21 // sevice. All method should be called from the origin thread (UI thread) which | 21 // sevice. All method should be called from the origin thread (UI thread) which |
22 // initializes the DBusThreadManager instance. | 22 // initializes the DBusThreadManager instance. |
23 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { | 23 class CHROMEOS_EXPORT AuthPolicyClient : public DBusClient { |
24 public: | 24 public: |
25 // |user_id| is a unique id for the users. Using objectGUID from Active | |
26 // Directory server. | |
27 using AuthCallback = base::OnceCallback<void( | 25 using AuthCallback = base::OnceCallback<void( |
28 authpolicy::ErrorType error, | 26 authpolicy::ErrorType error, |
29 const authpolicy::ActiveDirectoryAccountData& account_data)>; | 27 const authpolicy::ActiveDirectoryAccountInfo& account_info)>; |
| 28 using GetUserStatusCallback = base::OnceCallback<void( |
| 29 authpolicy::ErrorType error, |
| 30 const authpolicy::ActiveDirectoryUserStatus& user_status)>; |
30 using JoinCallback = base::OnceCallback<void(authpolicy::ErrorType error)>; | 31 using JoinCallback = base::OnceCallback<void(authpolicy::ErrorType error)>; |
31 using RefreshPolicyCallback = base::OnceCallback<void(bool success)>; | 32 using RefreshPolicyCallback = base::OnceCallback<void(bool success)>; |
32 | 33 |
33 ~AuthPolicyClient() override; | 34 ~AuthPolicyClient() override; |
34 | 35 |
35 // Factory function, creates a new instance and returns ownership. | 36 // Factory function, creates a new instance and returns ownership. |
36 // For normal usage, access the singleton via DBusThreadManager::Get(). | 37 // For normal usage, access the singleton via DBusThreadManager::Get(). |
37 static AuthPolicyClient* Create(); | 38 static AuthPolicyClient* Create(); |
38 | 39 |
39 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to | 40 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to |
(...skipping 12 matching lines...) Expand all Loading... |
52 // does kerberos authentication against Active Directory server. If | 53 // does kerberos authentication against Active Directory server. If |
53 // |object_guid| is not empty authpolicy service first does ldap search by | 54 // |object_guid| is not empty authpolicy service first does ldap search by |
54 // that |object_guid| for samAccountName and uses it for kinit. |password_fd| | 55 // that |object_guid| for samAccountName and uses it for kinit. |password_fd| |
55 // is similar to the one in the JoinAdDomain. |callback| is called after | 56 // is similar to the one in the JoinAdDomain. |callback| is called after |
56 // getting (or failing to get) D-BUS response. | 57 // getting (or failing to get) D-BUS response. |
57 virtual void AuthenticateUser(const std::string& user_principal_name, | 58 virtual void AuthenticateUser(const std::string& user_principal_name, |
58 const std::string& object_guid, | 59 const std::string& object_guid, |
59 int password_fd, | 60 int password_fd, |
60 AuthCallback callback) = 0; | 61 AuthCallback callback) = 0; |
61 | 62 |
| 63 // Calls GetUserStatus. If Active Directory server is online it fetches |
| 64 // ActiveDirectoryUserStatus for the user specified by |object_guid|. |
| 65 // |callback| is called after getting (or failing to get) D-Bus response. |
| 66 virtual void GetUserStatus(const std::string& object_guid, |
| 67 GetUserStatusCallback callback) = 0; |
| 68 |
62 // Calls RefreshDevicePolicy - handle policy for the device. | 69 // Calls RefreshDevicePolicy - handle policy for the device. |
63 // Fetch GPO files from Active directory server, parse it, encode it into | 70 // Fetch GPO files from Active directory server, parse it, encode it into |
64 // protobuf and send to SessionManager. Callback is called after that. | 71 // protobuf and send to SessionManager. Callback is called after that. |
65 virtual void RefreshDevicePolicy(RefreshPolicyCallback callback) = 0; | 72 virtual void RefreshDevicePolicy(RefreshPolicyCallback callback) = 0; |
66 | 73 |
67 // Calls RefreshUserPolicy - handle policy for the user specified by | 74 // Calls RefreshUserPolicy - handle policy for the user specified by |
68 // |account_id|. Similar to RefreshDevicePolicy. | 75 // |account_id|. Similar to RefreshDevicePolicy. |
69 virtual void RefreshUserPolicy(const AccountId& account_id, | 76 virtual void RefreshUserPolicy(const AccountId& account_id, |
70 RefreshPolicyCallback callback) = 0; | 77 RefreshPolicyCallback callback) = 0; |
71 | 78 |
72 protected: | 79 protected: |
73 // Create() should be used instead. | 80 // Create() should be used instead. |
74 AuthPolicyClient(); | 81 AuthPolicyClient(); |
75 | 82 |
76 private: | 83 private: |
77 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); | 84 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); |
78 }; | 85 }; |
79 | 86 |
80 } // namespace chromeos | 87 } // namespace chromeos |
81 | 88 |
82 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ | 89 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ |
OLD | NEW |