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