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

Side by Side Diff: chromeos/dbus/auth_policy_client.h

Issue 2794493002: Add AuthPolicyLoginHelper (Closed)
Patch Set: Update after review 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
« no previous file with comments | « chromeos/BUILD.gn ('k') | chromeos/dbus/auth_policy_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_account_data.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 25 // |user_id| is a unique id for the users. Using objectGUID from Active
26 // Directory server. 26 // Directory server.
27 using AuthCallback = base::Callback<void( 27 using AuthCallback = base::OnceCallback<void(
28 authpolicy::ErrorType error, 28 authpolicy::ErrorType error,
29 const authpolicy::ActiveDirectoryAccountData& account_data)>; 29 const authpolicy::ActiveDirectoryAccountData& account_data)>;
30 using JoinCallback = base::Callback<void(authpolicy::ErrorType error)>; 30 using JoinCallback = base::OnceCallback<void(authpolicy::ErrorType error)>;
31 using RefreshPolicyCallback = base::Callback<void(bool success)>; 31 using RefreshPolicyCallback = base::OnceCallback<void(bool success)>;
32 32
33 ~AuthPolicyClient() override; 33 ~AuthPolicyClient() override;
34 34
35 // Factory function, creates a new instance and returns ownership. 35 // Factory function, creates a new instance and returns ownership.
36 // For normal usage, access the singleton via DBusThreadManager::Get(). 36 // For normal usage, access the singleton via DBusThreadManager::Get().
37 static AuthPolicyClient* Create(); 37 static AuthPolicyClient* Create();
38 38
39 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to 39 // Calls JoinADDomain. It runs "net ads join ..." which joins machine to
40 // Active directory domain. 40 // Active directory domain.
41 // |machine_name| is a name for a local machine. |user_principal_name|, 41 // |machine_name| is a name for a local machine. |user_principal_name|,
42 // |password_fd| are credentials of the Active directory account which has 42 // |password_fd| are credentials of the Active directory account which has
43 // right to join the machine to the domain. |password_fd| is a file descriptor 43 // right to join the machine to the domain. |password_fd| is a file descriptor
44 // password is read from. The caller should close it after the call. 44 // password is read from. The caller should close it after the call.
45 // |callback| is called after getting (or failing to get) D-BUS response. 45 // |callback| is called after getting (or failing to get) D-BUS response.
46 virtual void JoinAdDomain(const std::string& machine_name, 46 virtual void JoinAdDomain(const std::string& machine_name,
47 const std::string& user_principal_name, 47 const std::string& user_principal_name,
48 int password_fd, 48 int password_fd,
49 const JoinCallback& callback) = 0; 49 JoinCallback callback) = 0;
50 50
51 // Calls AuthenticateUser. It runs "kinit <user_principal_name> .. " which 51 // Calls AuthenticateUser. It runs "kinit <user_principal_name> .. " which
52 // does kerberos authentication against Active Directory server. 52 // does kerberos authentication against Active Directory server.
53 // |password_fd| is similar to the one in the JoinAdDomain. 53 // |password_fd| is similar to the one in the JoinAdDomain.
54 // |callback| is called after getting (or failing to get) D-BUS response. 54 // |callback| is called after getting (or failing to get) D-BUS response.
55 virtual void AuthenticateUser(const std::string& user_principal_name, 55 virtual void AuthenticateUser(const std::string& user_principal_name,
56 int password_fd, 56 int password_fd,
57 const AuthCallback& callback) = 0; 57 AuthCallback callback) = 0;
58 58
59 // Calls RefreshDevicePolicy - handle policy for the device. 59 // Calls RefreshDevicePolicy - handle policy for the device.
60 // Fetch GPO files from Active directory server, parse it, encode it into 60 // Fetch GPO files from Active directory server, parse it, encode it into
61 // protobuf and send to SessionManager. Callback is called after that. 61 // protobuf and send to SessionManager. Callback is called after that.
62 virtual void RefreshDevicePolicy(const RefreshPolicyCallback& callback) = 0; 62 virtual void RefreshDevicePolicy(RefreshPolicyCallback callback) = 0;
63 63
64 // Calls RefreshUserPolicy - handle policy for the user specified by 64 // Calls RefreshUserPolicy - handle policy for the user specified by
65 // |account_id|. Similar to RefreshDevicePolicy. 65 // |account_id|. Similar to RefreshDevicePolicy.
66 virtual void RefreshUserPolicy(const AccountId& account_id, 66 virtual void RefreshUserPolicy(const AccountId& account_id,
67 const RefreshPolicyCallback& callback) = 0; 67 RefreshPolicyCallback callback) = 0;
68 68
69 protected: 69 protected:
70 // Create() should be used instead. 70 // Create() should be used instead.
71 AuthPolicyClient(); 71 AuthPolicyClient();
72 72
73 private: 73 private:
74 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient); 74 DISALLOW_COPY_AND_ASSIGN(AuthPolicyClient);
75 }; 75 };
76 76
77 } // namespace chromeos 77 } // namespace chromeos
78 78
79 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_ 79 #endif // CHROMEOS_DBUS_AUTH_POLICY_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/BUILD.gn ('k') | chromeos/dbus/auth_policy_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698