OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 5 #ifndef REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
6 #define REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 6 #define REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "remoting/protocol/authentication_method.h" | 14 #include "remoting/protocol/authentication_method.h" |
15 #include "remoting/protocol/authenticator.h" | 15 #include "remoting/protocol/authenticator.h" |
16 #include "remoting/protocol/third_party_host_authenticator.h" | 16 #include "remoting/protocol/third_party_host_authenticator.h" |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 class RsaKeyPair; | 20 class RsaKeyPair; |
21 | 21 |
22 namespace protocol { | 22 namespace protocol { |
23 | 23 |
24 class PairingRegistry; | 24 class PairingRegistry; |
25 | 25 |
26 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { | 26 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { |
27 public: | 27 public: |
28 // Create a factory that dispenses shared secret authenticators. | 28 // Create a factory that dispenses shared secret authenticators. |
29 static scoped_ptr<AuthenticatorFactory> CreateWithSharedSecret( | 29 static scoped_ptr<AuthenticatorFactory> CreateWithSharedSecret( |
| 30 const std::string& host_owner, |
30 const std::string& local_cert, | 31 const std::string& local_cert, |
31 scoped_refptr<RsaKeyPair> key_pair, | 32 scoped_refptr<RsaKeyPair> key_pair, |
32 const SharedSecretHash& shared_secret_hash, | 33 const SharedSecretHash& shared_secret_hash, |
33 scoped_refptr<PairingRegistry> pairing_registry); | 34 scoped_refptr<PairingRegistry> pairing_registry); |
34 | 35 |
35 // Create a factory that dispenses third party authenticators. | 36 // Create a factory that dispenses third party authenticators. |
36 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( | 37 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( |
| 38 const std::string& host_owner, |
37 const std::string& local_cert, | 39 const std::string& local_cert, |
38 scoped_refptr<RsaKeyPair> key_pair, | 40 scoped_refptr<RsaKeyPair> key_pair, |
39 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> | 41 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> |
40 token_validator_factory); | 42 token_validator_factory); |
41 | 43 |
42 // Create a factory that dispenses rejecting authenticators (used when the | 44 // Create a factory that dispenses rejecting authenticators (used when the |
43 // host config/policy is inconsistent) | 45 // host config/policy is inconsistent) |
44 static scoped_ptr<AuthenticatorFactory> CreateRejecting(); | 46 static scoped_ptr<AuthenticatorFactory> CreateRejecting(); |
45 | 47 |
46 Me2MeHostAuthenticatorFactory(); | 48 Me2MeHostAuthenticatorFactory(); |
47 virtual ~Me2MeHostAuthenticatorFactory(); | 49 virtual ~Me2MeHostAuthenticatorFactory(); |
48 | 50 |
49 // AuthenticatorFactory interface. | 51 // AuthenticatorFactory interface. |
50 virtual scoped_ptr<Authenticator> CreateAuthenticator( | 52 virtual scoped_ptr<Authenticator> CreateAuthenticator( |
51 const std::string& local_jid, | 53 const std::string& local_jid, |
52 const std::string& remote_jid, | 54 const std::string& remote_jid, |
53 const buzz::XmlElement* first_message) OVERRIDE; | 55 const buzz::XmlElement* first_message) OVERRIDE; |
54 | 56 |
55 private: | 57 private: |
56 // Used for all host authenticators. | 58 // Used for all host authenticators. |
| 59 std::string host_owner_; |
57 std::string local_cert_; | 60 std::string local_cert_; |
58 scoped_refptr<RsaKeyPair> key_pair_; | 61 scoped_refptr<RsaKeyPair> key_pair_; |
59 | 62 |
60 // Used only for shared secret host authenticators. | 63 // Used only for shared secret host authenticators. |
61 SharedSecretHash shared_secret_hash_; | 64 SharedSecretHash shared_secret_hash_; |
62 | 65 |
63 // Used only for third party host authenticators. | 66 // Used only for third party host authenticators. |
64 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> | 67 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> |
65 token_validator_factory_; | 68 token_validator_factory_; |
66 | 69 |
67 // Used only for pairing host authenticators. | 70 // Used only for pairing host authenticators. |
68 scoped_refptr<PairingRegistry> pairing_registry_; | 71 scoped_refptr<PairingRegistry> pairing_registry_; |
69 | 72 |
70 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); | 73 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); |
71 }; | 74 }; |
72 | 75 |
73 } // namespace protocol | 76 } // namespace protocol |
74 } // namespace remoting | 77 } // namespace remoting |
75 | 78 |
76 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 79 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
OLD | NEW |