| 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_
|
|
|