| // Copyright 2019 The Chromium OS 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 KERBEROS_KERBEROS_ADAPTOR_H_ |
| #define KERBEROS_KERBEROS_ADAPTOR_H_ |
| |
| #include <memory> |
| #include <vector> |
| |
| #include <base/macros.h> |
| #include <brillo/dbus/async_event_sequencer.h> |
| |
| #include "kerberos/account_manager.h" |
| #include "kerberos/org.chromium.Kerberos.h" |
| |
| namespace brillo { |
| namespace dbus_utils { |
| class DBusObject; |
| } |
| } // namespace brillo |
| |
| namespace kerberos { |
| |
| // Implementation of the Kerberos D-Bus interface. |
| class KerberosAdaptor : public org::chromium::KerberosAdaptor, |
| public org::chromium::KerberosInterface { |
| public: |
| explicit KerberosAdaptor( |
| std::unique_ptr<brillo::dbus_utils::DBusObject> dbus_object); |
| ~KerberosAdaptor(); |
| |
| // Registers the D-Bus object and interfaces. |
| void RegisterAsync( |
| const brillo::dbus_utils::AsyncEventSequencer::CompletionAction& |
| completion_callback); |
| |
| using ByteArray = std::vector<uint8_t>; |
| |
| // org::chromium::KerberosInterface: (see org.chromium.Kerberos.xml). |
| ByteArray AddAccount(const ByteArray& request_blob) override; |
| ByteArray RemoveAccount(const ByteArray& request_blob) override; |
| ByteArray SetConfig(const ByteArray& request_blob) override; |
| ByteArray AcquireKerberosTgt(const ByteArray& request_blob, |
| const base::ScopedFD& password_fd) override; |
| ByteArray GetKerberosFiles(const ByteArray& request_blob) override; |
| |
| private: |
| std::unique_ptr<brillo::dbus_utils::DBusObject> dbus_object_; |
| AccountManager manager_; |
| |
| DISALLOW_COPY_AND_ASSIGN(KerberosAdaptor); |
| }; |
| |
| } // namespace kerberos |
| |
| #endif // KERBEROS_KERBEROS_ADAPTOR_H_ |