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

Unified Diff: chromeos/login/auth/authpolicy_login_helper.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/upstart_client.cc ('k') | chromeos/login/auth/authpolicy_login_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/login/auth/authpolicy_login_helper.h
diff --git a/chromeos/login/auth/authpolicy_login_helper.h b/chromeos/login/auth/authpolicy_login_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..1472c664676403ebfab6386bb55a21bdd60e449b
--- /dev/null
+++ b/chromeos/login/auth/authpolicy_login_helper.h
@@ -0,0 +1,60 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_LOGIN_AUTH_AUTHPOLICY_LOGIN_HELPER_H_
+#define CHROMEOS_LOGIN_AUTH_AUTHPOLICY_LOGIN_HELPER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/files/scoped_file.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "chromeos/dbus/auth_policy_client.h"
+
+namespace chromeos {
+
+// Helper class to use AuthPolicyClient. For Active Directory domain join and
+// authenticate users this class should be used instead of AuthPolicyClient.
+// Allows canceling all pending calls and restarting AuthPolicy service. Used
+// for enrollment and login UI to proper cancel the flows.
+class CHROMEOS_EXPORT AuthPolicyLoginHelper {
+ public:
+ using AuthCallback = AuthPolicyClient::AuthCallback;
+ using JoinCallback = AuthPolicyClient::JoinCallback;
+
+ AuthPolicyLoginHelper();
+ ~AuthPolicyLoginHelper();
+
+ // See AuthPolicyClient::JoinAdDomain.
+ void JoinAdDomain(const std::string& machine_name,
+ const std::string& username,
+ const std::string& password,
+ JoinCallback callback);
+
+ // See AuthPolicyClient::AuthenticateUser.
+ void AuthenticateUser(const std::string& username,
+ const std::string& password,
+ AuthCallback callback);
+
+ // Cancel pending requests and restarts AuthPolicy service.
+ void CancelRequestsAndRestart();
+
+ private:
+ // Called from AuthPolicyClient::JoinAdDomain.
+ void OnJoinCallback(JoinCallback callback, authpolicy::ErrorType error);
+
+ // Called from AuthPolicyClient::AuthenticateUser.
+ void OnAuthCallback(
+ AuthCallback callback,
+ authpolicy::ErrorType error,
+ const authpolicy::ActiveDirectoryAccountData& account_data);
+
+ base::WeakPtrFactory<AuthPolicyLoginHelper> weak_factory_;
+ DISALLOW_COPY_AND_ASSIGN(AuthPolicyLoginHelper);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_LOGIN_AUTH_AUTHPOLICY_LOGIN_HELPER_H_
« no previous file with comments | « chromeos/dbus/upstart_client.cc ('k') | chromeos/login/auth/authpolicy_login_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698