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