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_AUTH_HANDLER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ |
6 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_AUTH_HANDLER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_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/time/time.h" | 12 #include "base/time/time.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class FilePath; | 15 class FilePath; |
16 } // namespace base | 16 } // namespace base |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 class ClientSessionDetails; | 20 class ClientSessionDetails; |
21 | 21 |
22 // Class responsible for proxying authentication data between a local gnubbyd | 22 // Class responsible for proxying authentication data between a local gnubbyd |
23 // and the client. | 23 // and the client. |
24 class GnubbyAuthHandler { | 24 class SecurityKeyAuthHandler { |
25 public: | 25 public: |
26 virtual ~GnubbyAuthHandler() {} | 26 virtual ~SecurityKeyAuthHandler() {} |
27 | 27 |
28 // Used to send gnubby extension messages to the client. | 28 // Used to send security key extension messages to the client. |
29 typedef base::Callback<void(int connection_id, const std::string& data)> | 29 typedef base::Callback<void(int connection_id, const std::string& data)> |
30 SendMessageCallback; | 30 SendMessageCallback; |
31 | 31 |
32 // Creates a platform-specific GnubbyAuthHandler. | 32 // Creates a platform-specific SecurityKeyAuthHandler. |
33 // All invocations of |send_message_callback| are guaranteed to occur before | 33 // All invocations of |send_message_callback| are guaranteed to occur before |
34 // the underlying GnubbyAuthHandler object is destroyed. It is not safe to | 34 // the underlying SecurityKeyAuthHandler object is destroyed. It is not safe |
35 // destroy the GnubbyAuthHandler object within the callback. | 35 // to destroy the SecurityKeyAuthHandler object within the callback. |
36 // |client_session_details| will be valid until this instance is destroyed. | 36 // |client_session_details| will be valid until this instance is destroyed. |
37 static std::unique_ptr<GnubbyAuthHandler> Create( | 37 static std::unique_ptr<SecurityKeyAuthHandler> Create( |
38 ClientSessionDetails* client_session_details, | 38 ClientSessionDetails* client_session_details, |
39 const SendMessageCallback& send_message_callback); | 39 const SendMessageCallback& send_message_callback); |
40 | 40 |
41 #if defined(OS_LINUX) | 41 #if defined(OS_LINUX) |
42 // Specify the name of the socket to listen to gnubby requests on. | 42 // Specify the name of the socket to listen to security key requests on. |
43 static void SetGnubbySocketName(const base::FilePath& gnubby_socket_name); | 43 static void SetSecurityKeySocketName( |
| 44 const base::FilePath& security_key_socket_name); |
44 #endif // defined(OS_LINUX) | 45 #endif // defined(OS_LINUX) |
45 | 46 |
46 // Sets the callback used to send messages to the client. | 47 // Sets the callback used to send messages to the client. |
47 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; | 48 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; |
48 | 49 |
49 // Creates the platform specific connection to handle gnubby requests. | 50 // Creates the platform specific connection to handle security key requests. |
50 virtual void CreateGnubbyConnection() = 0; | 51 virtual void CreateSecurityKeyConnection() = 0; |
51 | 52 |
52 // Returns true if |gnubby_connection_id| represents a valid connection. | 53 // Returns true if |security_key_connection_id| represents a valid connection. |
53 virtual bool IsValidConnectionId(int gnubby_connection_id) const = 0; | 54 virtual bool IsValidConnectionId(int security_key_connection_id) const = 0; |
54 | 55 |
55 // Sends the gnubby response from the client to the local gnubby agent. | 56 // Sends security key response from client to local security key agent. |
56 virtual void SendClientResponse(int gnubby_connection_id, | 57 virtual void SendClientResponse(int security_key_connection_id, |
57 const std::string& response) = 0; | 58 const std::string& response) = 0; |
58 | 59 |
59 // Closes the gnubby connection represented by |gnubby_connection_id|. | 60 // Closes key connection represented by |security_key_connection_id|. |
60 virtual void SendErrorAndCloseConnection(int gnubby_connection_id) = 0; | 61 virtual void SendErrorAndCloseConnection(int security_key_connection_id) = 0; |
61 | 62 |
62 // Returns the number of active gnubby connections. | 63 // Returns the number of active security key connections. |
63 virtual size_t GetActiveConnectionCountForTest() const = 0; | 64 virtual size_t GetActiveConnectionCountForTest() const = 0; |
64 | 65 |
65 // Sets the timeout used when waiting for a gnubby response. | 66 // Sets the timeout used when waiting for a security key response. |
66 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; | 67 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; |
67 }; | 68 }; |
68 | 69 |
69 } // namespace remoting | 70 } // namespace remoting |
70 | 71 |
71 #endif // REMOTING_HOST_SECURITY_KEY_GNUBBY_AUTH_HANDLER_H_ | 72 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ |
OLD | NEW |