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; |
| 25 |
24 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { | 26 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { |
25 public: | 27 public: |
26 // Create a factory that dispenses shared secret authenticators. | 28 // Create a factory that dispenses shared secret authenticators. |
27 static scoped_ptr<AuthenticatorFactory> CreateWithSharedSecret( | 29 static scoped_ptr<AuthenticatorFactory> CreateWithSharedSecret( |
28 const std::string& local_cert, | 30 const std::string& local_cert, |
29 scoped_refptr<RsaKeyPair> key_pair, | 31 scoped_refptr<RsaKeyPair> key_pair, |
30 const SharedSecretHash& shared_secret_hash); | 32 const SharedSecretHash& shared_secret_hash, |
| 33 scoped_refptr<PairingRegistry> pairing_registry); |
| 34 |
31 // Create a factory that dispenses third party authenticators. | 35 // Create a factory that dispenses third party authenticators. |
32 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( | 36 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( |
33 const std::string& local_cert, | 37 const std::string& local_cert, |
34 scoped_refptr<RsaKeyPair> key_pair, | 38 scoped_refptr<RsaKeyPair> key_pair, |
35 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> | 39 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> |
36 token_validator_factory); | 40 token_validator_factory); |
| 41 |
37 // Create a factory that dispenses rejecting authenticators (used when the | 42 // Create a factory that dispenses rejecting authenticators (used when the |
38 // host config/policy is inconsistent) | 43 // host config/policy is inconsistent) |
39 static scoped_ptr<AuthenticatorFactory> CreateRejecting(); | 44 static scoped_ptr<AuthenticatorFactory> CreateRejecting(); |
40 | 45 |
41 Me2MeHostAuthenticatorFactory(); | 46 Me2MeHostAuthenticatorFactory(); |
42 virtual ~Me2MeHostAuthenticatorFactory(); | 47 virtual ~Me2MeHostAuthenticatorFactory(); |
43 | 48 |
44 // AuthenticatorFactory interface. | 49 // AuthenticatorFactory interface. |
45 virtual scoped_ptr<Authenticator> CreateAuthenticator( | 50 virtual scoped_ptr<Authenticator> CreateAuthenticator( |
46 const std::string& local_jid, | 51 const std::string& local_jid, |
47 const std::string& remote_jid, | 52 const std::string& remote_jid, |
48 const buzz::XmlElement* first_message) OVERRIDE; | 53 const buzz::XmlElement* first_message) OVERRIDE; |
49 | 54 |
50 private: | 55 private: |
51 // Used for all host authenticators. | 56 // Used for all host authenticators. |
52 std::string local_cert_; | 57 std::string local_cert_; |
53 scoped_refptr<RsaKeyPair> key_pair_; | 58 scoped_refptr<RsaKeyPair> key_pair_; |
54 | 59 |
55 // Used only for shared secret host authenticators. | 60 // Used only for shared secret host authenticators. |
56 SharedSecretHash shared_secret_hash_; | 61 SharedSecretHash shared_secret_hash_; |
57 | 62 |
58 // Used only for third party host authenticators. | 63 // Used only for third party host authenticators. |
59 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> | 64 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidatorFactory> |
60 token_validator_factory_; | 65 token_validator_factory_; |
61 | 66 |
| 67 // Used only for pairing host authenticators. |
| 68 scoped_refptr<PairingRegistry> pairing_registry_; |
| 69 |
62 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); | 70 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); |
63 }; | 71 }; |
64 | 72 |
65 } // namespace protocol | 73 } // namespace protocol |
66 } // namespace remoting | 74 } // namespace remoting |
67 | 75 |
68 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 76 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
OLD | NEW |