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

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

Issue 2794493002: Add AuthPolicyLoginHelper (Closed)
Patch Set: Switch to OnceCallback+Update on comments+rebase 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
(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 // See AuthPolicyClient::JoinAdDomain.
xiyuan 2017/04/07 15:04:24 nit: insert an empty line before
Roman Sorokin (ftl) 2017/04/10 16:09:00 Done.
30 void JoinAdDomain(const std::string& machine_name,
31 const std::string& username,
32 const std::string& password,
33 JoinCallback callback);
34 // See AuthPolicyClient::AuthenticateUser.
xiyuan 2017/04/07 15:04:24 nit: insert an empty line before
Roman Sorokin (ftl) 2017/04/10 16:09:00 Done.
35 void AuthenticateUser(const std::string& username,
36 const std::string& password,
37 AuthCallback callback);
38 // Cancel pending requests and restarts AuthPolicy service.
xiyuan 2017/04/07 15:04:24 nit: insert an empty line before
Roman Sorokin (ftl) 2017/04/10 16:09:00 Done.
39 void CancelRequestsAndRestart();
40
41 private:
42 // Called from AuthPolicyClient::JoinAdDomain.
43 void OnJoinCallback(JoinCallback callback, authpolicy::ErrorType error);
44
45 // Called from AuthPolicyClient::AuthenticateUser.
46 void OnAuthCallback(
47 AuthCallback callback,
48 authpolicy::ErrorType error,
49 const authpolicy::ActiveDirectoryAccountData& account_data);
50
51 base::WeakPtrFactory<AuthPolicyLoginHelper> weak_factory_;
52 DISALLOW_COPY_AND_ASSIGN(AuthPolicyLoginHelper);
53 };
54
55 } // namespace chromeos
56
57 #endif // CHROMEOS_LOGIN_AUTH_AUTHPOLICY_LOGIN_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698