OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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_SIMPLE_HOST_AUTHENTICATOR_H_ | |
6 #define REMOTING_PROTOCOL_SIMPLE_HOST_AUTHENTICATOR_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "remoting/protocol/authenticator.h" | |
12 | |
13 namespace crypto { | |
14 class RSAPrivateKey; | |
15 } // namespace base | |
16 | |
17 namespace remoting { | |
18 namespace protocol { | |
19 | |
20 class SimpleHostAuthenticator : public Authenticator { | |
Wez
2011/11/22 22:58:05
nit: It may be worth folding the client and host a
Sergey Ulanov
2011/11/23 02:02:25
Done
| |
21 public: | |
22 explicit SimpleHostAuthenticator(const std::string& local_cert, | |
23 crypto::RSAPrivateKey* local_private_key, | |
24 const std::string& shared_secret, | |
25 const std::string& remote_jid); | |
26 virtual ~SimpleHostAuthenticator(); | |
27 | |
28 // Authenticator implementation. | |
29 virtual State state() const OVERRIDE; | |
30 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; | |
31 virtual buzz::XmlElement* GetNextMessage() OVERRIDE; | |
32 virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; | |
33 | |
34 private: | |
35 std::string local_cert_; | |
36 crypto::RSAPrivateKey* local_private_key_; | |
37 std::string shared_secret_; | |
38 std::string remote_jid_; | |
39 State state_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(SimpleHostAuthenticator); | |
42 }; | |
43 | |
44 class SimpleHostAuthenticatorFactory : public AuthenticatorFactory { | |
45 public: | |
46 // Doesn't take ownership of |local_private_key|. | |
47 SimpleHostAuthenticatorFactory(const std::string& local_cert, | |
48 crypto::RSAPrivateKey* local_private_key, | |
49 const std::string& shared_secret); | |
50 virtual ~SimpleHostAuthenticatorFactory(); | |
51 | |
52 // AuthenticatorFactory implementation. | |
53 virtual Authenticator* CreateAuthenticator( | |
54 const std::string& remote_jid, | |
55 const buzz::XmlElement* first_message) OVERRIDE; | |
56 | |
57 private: | |
58 std::string local_cert_; | |
59 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; | |
60 std::string shared_secret_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(SimpleHostAuthenticatorFactory); | |
63 }; | |
64 | |
65 } // namespace protocol | |
66 } // namespace remoting | |
67 | |
68 #endif // REMOTING_PROTOCOL_SIMPLE_HOST_AUTHENTICATOR_H_ | |
OLD | NEW |