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