Chromium Code Reviews| 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_GNUBBY_AUTH_HANDLER_H_ |
| 6 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_AUTH_HANDLER_H_ | 6 #define REMOTING_HOST_SECURITY_KEY_GNUBBY_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; | |
| 21 | |
| 20 // Class responsible for proxying authentication data between a local gnubbyd | 22 // Class responsible for proxying authentication data between a local gnubbyd |
| 21 // and the client. | 23 // and the client. |
| 22 class GnubbyAuthHandler { | 24 class GnubbyAuthHandler { |
| 23 public: | 25 public: |
| 24 virtual ~GnubbyAuthHandler() {} | 26 virtual ~GnubbyAuthHandler() {} |
| 25 | 27 |
| 26 // Used to send gnubby extension messages to the client. | 28 // Used to send gnubby extension messages to the client. |
| 27 typedef base::Callback<void(int connection_id, const std::string& data)> | 29 typedef base::Callback<void(int connection_id, const std::string& data)> |
| 28 SendMessageCallback; | 30 SendMessageCallback; |
| 29 | 31 |
| 30 // Creates a platform-specific GnubbyAuthHandler. | 32 // Creates a platform-specific GnubbyAuthHandler. |
| 31 // All invocations of |callback| are guaranteed to occur before the underlying | 33 // All invocations of the callbacks are guaranteed to occur before the |
|
Sergey Ulanov
2016/06/29 22:36:46
rephrase this, now that there is only one callback
joedow
2016/06/30 00:10:08
Done.
| |
| 32 // GnubbyAuthHandler object is destroyed. It is not safe to destroy the | 34 // underlying GnubbyAuthHandler object is destroyed. It is not safe to |
| 33 // GnubbyAuthHandler object within the callback. | 35 // destroy the GnubbyAuthHandler object within the callback. |
| 34 static std::unique_ptr<GnubbyAuthHandler> Create( | 36 static std::unique_ptr<GnubbyAuthHandler> Create( |
| 35 const SendMessageCallback& callback); | 37 ClientSessionDetails* client_session_details, |
| 38 const SendMessageCallback& send_message_callback); | |
| 36 | 39 |
| 37 #if defined(OS_LINUX) | 40 #if defined(OS_LINUX) |
| 38 // Specify the name of the socket to listen to gnubby requests on. | 41 // Specify the name of the socket to listen to gnubby requests on. |
| 39 static void SetGnubbySocketName(const base::FilePath& gnubby_socket_name); | 42 static void SetGnubbySocketName(const base::FilePath& gnubby_socket_name); |
| 40 #endif // defined(OS_LINUX) | 43 #endif // defined(OS_LINUX) |
| 41 | 44 |
| 42 // Sets the callback used to send messages to the client. | 45 // Sets the callback used to send messages to the client. |
| 43 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; | 46 virtual void SetSendMessageCallback(const SendMessageCallback& callback) = 0; |
| 44 | 47 |
| 45 // Creates the platform specific connection to handle gnubby requests. | 48 // Creates the platform specific connection to handle gnubby requests. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 58 // Returns the number of active gnubby connections. | 61 // Returns the number of active gnubby connections. |
| 59 virtual size_t GetActiveConnectionCountForTest() const = 0; | 62 virtual size_t GetActiveConnectionCountForTest() const = 0; |
| 60 | 63 |
| 61 // Sets the timeout used when waiting for a gnubby response. | 64 // Sets the timeout used when waiting for a gnubby response. |
| 62 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; | 65 virtual void SetRequestTimeoutForTest(base::TimeDelta timeout) = 0; |
| 63 }; | 66 }; |
| 64 | 67 |
| 65 } // namespace remoting | 68 } // namespace remoting |
| 66 | 69 |
| 67 #endif // REMOTING_HOST_SECURITY_KEY_GNUBBY_AUTH_HANDLER_H_ | 70 #endif // REMOTING_HOST_SECURITY_KEY_GNUBBY_AUTH_HANDLER_H_ |
| OLD | NEW |