Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_AUTHENTICATED_CHANNEL_FACTORY_H_ | |
| 6 #define REMOTING_PROTOCOL_AUTHENTICATED_CHANNEL_FACTORY_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "net/base/net_errors.h" | |
| 12 #include "remoting/protocol/channel_factory.h" | |
| 13 | |
| 14 namespace remoting { | |
| 15 namespace protocol { | |
| 16 | |
| 17 class Authenticator; | |
| 18 class ChannelAuthenticator; | |
| 19 | |
| 20 // ChannelFactory wrapper that authenticates every channel it creates. When | |
| 21 // CreateChannel() is called it first calls the wrapped ChannelFactory to create | |
| 22 // a channel and then uses the specified Authenticator to secure and | |
| 23 // authenticate the new channel before returning it to the caller. | |
| 24 class AuthenticatedChannelFactory : public ChannelFactory { | |
|
Wez
2014/09/10 02:29:26
SecureChannelFactory?
Sergey Ulanov
2014/09/10 21:50:58
Yes, thank you!
| |
| 25 public: | |
| 26 // Both parameters must outlive the object. | |
| 27 AuthenticatedChannelFactory(ChannelFactory* channel_factory, | |
| 28 Authenticator* authenticator); | |
| 29 virtual ~AuthenticatedChannelFactory(); | |
| 30 | |
| 31 // ChannelFactory interface. | |
| 32 virtual void CreateChannel(const std::string& name, | |
| 33 const ChannelCreatedCallback& callback) OVERRIDE; | |
| 34 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; | |
| 35 | |
| 36 private: | |
| 37 typedef std::map<std::string, ChannelAuthenticator*> ChannelsMap; | |
|
Wez
2014/09/10 02:29:26
AuthenticatorMap? or ChannelAuthenticatorMap?
Sergey Ulanov
2014/09/10 21:50:58
Done.
| |
| 38 | |
| 39 void OnBaseChannelCreated(const std::string& name, | |
| 40 const ChannelCreatedCallback& callback, | |
| 41 scoped_ptr<net::StreamSocket> socket); | |
| 42 | |
| 43 void OnAuthenticated(const std::string& name, | |
|
Wez
2014/09/10 02:29:26
nit: OnSecureChannelCreated?
Sergey Ulanov
2014/09/10 21:50:58
Done.
| |
| 44 const ChannelCreatedCallback& callback, | |
| 45 net::Error error, | |
| 46 scoped_ptr<net::StreamSocket> socket); | |
| 47 | |
| 48 ChannelFactory* channel_factory_; | |
| 49 Authenticator* authenticator_; | |
| 50 | |
| 51 ChannelsMap channels_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(AuthenticatedChannelFactory); | |
| 54 }; | |
| 55 | |
| 56 } // namespace protocol | |
| 57 } // namespace remoting | |
| 58 | |
| 59 #endif // REMOTING_PROTOCOL_AUTHENTICATED_CHANNEL_FACTORY_H_ | |
| OLD | NEW |