OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/macros.h" |
| 13 #include "base/threading/thread_checker.h" |
| 14 #include "remoting/host/host_extension_session.h" |
| 15 |
| 16 namespace base { |
| 17 class DictionaryValue; |
| 18 } |
| 19 |
| 20 namespace remoting { |
| 21 |
| 22 class ClientSessionDetails; |
| 23 class GnubbyAuthHandler; |
| 24 |
| 25 namespace protocol { |
| 26 class ClientStub; |
| 27 } |
| 28 |
| 29 // A HostExtensionSession implementation that enables Security Key support. |
| 30 class GnubbyExtensionSession : public HostExtensionSession { |
| 31 public: |
| 32 GnubbyExtensionSession(ClientSessionDetails* client_session_details, |
| 33 protocol::ClientStub* client_stub); |
| 34 ~GnubbyExtensionSession() override; |
| 35 |
| 36 // HostExtensionSession interface. |
| 37 bool OnExtensionMessage(ClientSessionDetails* client_session_details, |
| 38 protocol::ClientStub* client_stub, |
| 39 const protocol::ExtensionMessage& message) override; |
| 40 |
| 41 // Allows the underlying GnubbyAuthHandler to be overridden for unit testing. |
| 42 void SetGnubbyAuthHandlerForTesting( |
| 43 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler); |
| 44 |
| 45 private: |
| 46 // These methods process specific gnubby extension message types. |
| 47 void ProcessControlMessage(base::DictionaryValue* message_data) const; |
| 48 void ProcessDataMessage(base::DictionaryValue* message_data) const; |
| 49 void ProcessErrorMessage(base::DictionaryValue* message_data) const; |
| 50 |
| 51 void SendMessageToClient(int connection_id, const std::string& data) const; |
| 52 |
| 53 // Ensures GnubbyExtensionSession methods are called on the same thread. |
| 54 base::ThreadChecker thread_checker_; |
| 55 |
| 56 // Interface through which messages can be sent to the client. |
| 57 protocol::ClientStub* client_stub_ = nullptr; |
| 58 |
| 59 // Handles platform specific gnubby operations. |
| 60 std::unique_ptr<GnubbyAuthHandler> gnubby_auth_handler_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(GnubbyExtensionSession); |
| 63 }; |
| 64 |
| 65 } // namespace remoting |
| 66 |
| 67 #endif // REMOTING_HOST_SECURITY_KEY_GNUBBY_EXTENSION_SESSION_H_ |
OLD | NEW |