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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.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 #include "remoting/protocol/token_validator.h" | 17 #include "remoting/protocol/token_validator.h" |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 class RsaKeyPair; | 21 class RsaKeyPair; |
22 | 22 |
23 namespace protocol { | 23 namespace protocol { |
24 | 24 |
25 class PairingRegistry; | 25 class PairingRegistry; |
26 | 26 |
27 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { | 27 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { |
28 public: | 28 public: |
29 // Create a factory that dispenses shared secret authenticators. | 29 // Create a factory that dispenses shared secret authenticators. |
30 static scoped_ptr<AuthenticatorFactory> CreateWithSharedSecret( | 30 static scoped_ptr<AuthenticatorFactory> CreateWithPin( |
31 bool use_service_account, | 31 bool use_service_account, |
32 const std::string& host_owner, | 32 const std::string& host_owner, |
33 const std::string& local_cert, | 33 const std::string& local_cert, |
34 scoped_refptr<RsaKeyPair> key_pair, | 34 scoped_refptr<RsaKeyPair> key_pair, |
35 const std::string& required_client_domain, | 35 const std::string& required_client_domain, |
36 const SharedSecretHash& shared_secret_hash, | 36 const std::string& pin_hash, |
37 scoped_refptr<PairingRegistry> pairing_registry); | 37 scoped_refptr<PairingRegistry> pairing_registry); |
38 | 38 |
39 // Create a factory that dispenses third party authenticators. | 39 // Create a factory that dispenses third party authenticators. |
40 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( | 40 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( |
41 bool use_service_account, | 41 bool use_service_account, |
42 const std::string& host_owner, | 42 const std::string& host_owner, |
43 const std::string& local_cert, | 43 const std::string& local_cert, |
44 scoped_refptr<RsaKeyPair> key_pair, | 44 scoped_refptr<RsaKeyPair> key_pair, |
45 const std::string& required_client_domain, | 45 const std::string& required_client_domain, |
46 scoped_ptr<TokenValidatorFactory> token_validator_factory); | 46 scoped_ptr<TokenValidatorFactory> token_validator_factory); |
47 | 47 |
48 Me2MeHostAuthenticatorFactory(); | 48 Me2MeHostAuthenticatorFactory(); |
49 ~Me2MeHostAuthenticatorFactory() override; | 49 ~Me2MeHostAuthenticatorFactory() override; |
50 | 50 |
51 // AuthenticatorFactory interface. | 51 // AuthenticatorFactory interface. |
52 scoped_ptr<Authenticator> CreateAuthenticator( | 52 scoped_ptr<Authenticator> CreateAuthenticator( |
53 const std::string& local_jid, | 53 const std::string& local_jid, |
54 const std::string& remote_jid, | 54 const std::string& remote_jid, |
55 const buzz::XmlElement* first_message) override; | 55 const buzz::XmlElement* first_message) override; |
56 | 56 |
57 private: | 57 private: |
58 // Used for all host authenticators. | 58 // Used for all host authenticators. |
59 bool use_service_account_; | 59 bool use_service_account_; |
60 std::string host_owner_; | 60 std::string host_owner_; |
61 std::string local_cert_; | 61 std::string local_cert_; |
62 scoped_refptr<RsaKeyPair> key_pair_; | 62 scoped_refptr<RsaKeyPair> key_pair_; |
63 std::string required_client_domain_; | 63 std::string required_client_domain_; |
64 | 64 |
65 // Used only for shared secret host authenticators. | 65 // Used only for PIN-based host authenticators. |
66 SharedSecretHash shared_secret_hash_; | 66 std::string pin_hash_; |
67 | 67 |
68 // Used only for third party host authenticators. | 68 // Used only for third party host authenticators. |
69 scoped_ptr<TokenValidatorFactory> token_validator_factory_; | 69 scoped_ptr<TokenValidatorFactory> token_validator_factory_; |
70 | 70 |
71 // Used only for pairing host authenticators. | 71 // Used only for pairing host authenticators. |
72 scoped_refptr<PairingRegistry> pairing_registry_; | 72 scoped_refptr<PairingRegistry> pairing_registry_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); | 74 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace protocol | 77 } // namespace protocol |
78 } // namespace remoting | 78 } // namespace remoting |
79 | 79 |
80 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 80 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
OLD | NEW |