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_SECURITY_KEY_AUTH_HANDLER_H_ | 5 #ifndef REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ |
6 #define REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_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/memory/ref_counted.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class FilePath; | 16 class FilePath; |
| 17 class SingleThreadTaskRunner; |
16 } // namespace base | 18 } // namespace base |
17 | 19 |
18 namespace remoting { | 20 namespace remoting { |
19 | 21 |
20 class ClientSessionDetails; | 22 class ClientSessionDetails; |
21 | 23 |
22 // Class responsible for proxying authentication data between a local gnubbyd | 24 // Class responsible for proxying authentication data between a local gnubbyd |
23 // and the client. | 25 // and the client. |
24 class SecurityKeyAuthHandler { | 26 class SecurityKeyAuthHandler { |
25 public: | 27 public: |
26 virtual ~SecurityKeyAuthHandler() {} | 28 virtual ~SecurityKeyAuthHandler() {} |
27 | 29 |
28 // Used to send security key extension messages to the client. | 30 // Used to send security key extension messages to the client. |
29 typedef base::Callback<void(int connection_id, const std::string& data)> | 31 typedef base::Callback<void(int connection_id, const std::string& data)> |
30 SendMessageCallback; | 32 SendMessageCallback; |
31 | 33 |
32 // Creates a platform-specific SecurityKeyAuthHandler. | 34 // Creates a platform-specific SecurityKeyAuthHandler. |
33 // All invocations of |send_message_callback| are guaranteed to occur before | 35 // All invocations of |send_message_callback| are guaranteed to occur before |
34 // the underlying SecurityKeyAuthHandler object is destroyed. It is not safe | 36 // the underlying SecurityKeyAuthHandler object is destroyed. It is not safe |
35 // to destroy the SecurityKeyAuthHandler object within the callback. | 37 // to destroy the SecurityKeyAuthHandler object within the callback. |
36 // |client_session_details| will be valid until this instance is destroyed. | 38 // |client_session_details| will be valid until this instance is destroyed. |
37 static std::unique_ptr<SecurityKeyAuthHandler> Create( | 39 static std::unique_ptr<SecurityKeyAuthHandler> Create( |
38 ClientSessionDetails* client_session_details, | 40 ClientSessionDetails* client_session_details, |
39 const SendMessageCallback& send_message_callback); | 41 const SendMessageCallback& send_message_callback, |
| 42 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); |
40 | 43 |
41 #if defined(OS_LINUX) | 44 #if defined(OS_LINUX) |
42 // Specify the name of the socket to listen to security key requests on. | 45 // Specify the name of the socket to listen to security key requests on. |
43 static void SetSecurityKeySocketName( | 46 static void SetSecurityKeySocketName( |
44 const base::FilePath& security_key_socket_name); | 47 const base::FilePath& security_key_socket_name); |
45 #endif // defined(OS_LINUX) | 48 #endif // defined(OS_LINUX) |
46 | 49 |
47 // Sets the callback used to send messages to the client. | 50 // Sets the callback used to send messages to the client. |
48 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; | 51 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; |
49 | 52 |
(...skipping 13 matching lines...) Expand all Loading... |
63 // Returns the number of active security key connections. | 66 // Returns the number of active security key connections. |
64 virtual size_t GetActiveConnectionCountForTest() const = 0; | 67 virtual size_t GetActiveConnectionCountForTest() const = 0; |
65 | 68 |
66 // Sets the timeout used when waiting for a security key response. | 69 // Sets the timeout used when waiting for a security key response. |
67 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; | 70 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; |
68 }; | 71 }; |
69 | 72 |
70 } // namespace remoting | 73 } // namespace remoting |
71 | 74 |
72 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ | 75 #endif // REMOTING_HOST_SECURITY_KEY_SECURITY_KEY_AUTH_HANDLER_H_ |
OLD | NEW |