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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "remoting/protocol/authenticator.h" | 14 #include "remoting/protocol/authenticator.h" |
15 #include "remoting/protocol/third_party_host_authenticator.h" | 15 #include "remoting/protocol/third_party_host_authenticator.h" |
16 #include "remoting/protocol/token_validator.h" | 16 #include "remoting/protocol/token_validator.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> CreateWithPin( | 29 static std::unique_ptr<AuthenticatorFactory> CreateWithPin( |
30 bool use_service_account, | 30 bool use_service_account, |
31 const std::string& host_owner, | 31 const std::string& host_owner, |
32 const std::string& local_cert, | 32 const std::string& local_cert, |
33 scoped_refptr<RsaKeyPair> key_pair, | 33 scoped_refptr<RsaKeyPair> key_pair, |
34 const std::string& required_client_domain, | 34 const std::string& required_client_domain, |
35 const std::string& pin_hash, | 35 const std::string& pin_hash, |
36 scoped_refptr<PairingRegistry> pairing_registry); | 36 scoped_refptr<PairingRegistry> pairing_registry); |
37 | 37 |
38 // Create a factory that dispenses third party authenticators. | 38 // Create a factory that dispenses third party authenticators. |
39 static scoped_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( | 39 static std::unique_ptr<AuthenticatorFactory> CreateWithThirdPartyAuth( |
40 bool use_service_account, | 40 bool use_service_account, |
41 const std::string& host_owner, | 41 const std::string& host_owner, |
42 const std::string& local_cert, | 42 const std::string& local_cert, |
43 scoped_refptr<RsaKeyPair> key_pair, | 43 scoped_refptr<RsaKeyPair> key_pair, |
44 const std::string& required_client_domain, | 44 const std::string& required_client_domain, |
45 scoped_refptr<TokenValidatorFactory> token_validator_factory); | 45 scoped_refptr<TokenValidatorFactory> token_validator_factory); |
46 | 46 |
47 Me2MeHostAuthenticatorFactory(); | 47 Me2MeHostAuthenticatorFactory(); |
48 ~Me2MeHostAuthenticatorFactory() override; | 48 ~Me2MeHostAuthenticatorFactory() override; |
49 | 49 |
50 // AuthenticatorFactory interface. | 50 // AuthenticatorFactory interface. |
51 scoped_ptr<Authenticator> CreateAuthenticator( | 51 std::unique_ptr<Authenticator> CreateAuthenticator( |
52 const std::string& local_jid, | 52 const std::string& local_jid, |
53 const std::string& remote_jid) override; | 53 const std::string& remote_jid) override; |
54 | 54 |
55 private: | 55 private: |
56 // Used for all host authenticators. | 56 // Used for all host authenticators. |
57 bool use_service_account_; | 57 bool use_service_account_; |
58 std::string host_owner_; | 58 std::string host_owner_; |
59 std::string local_cert_; | 59 std::string local_cert_; |
60 scoped_refptr<RsaKeyPair> key_pair_; | 60 scoped_refptr<RsaKeyPair> key_pair_; |
61 std::string required_client_domain_; | 61 std::string required_client_domain_; |
62 | 62 |
63 // Used only for PIN-based host authenticators. | 63 // Used only for PIN-based host authenticators. |
64 std::string pin_hash_; | 64 std::string pin_hash_; |
65 | 65 |
66 // Used only for third party host authenticators. | 66 // Used only for third party host authenticators. |
67 scoped_refptr<TokenValidatorFactory> token_validator_factory_; | 67 scoped_refptr<TokenValidatorFactory> token_validator_factory_; |
68 | 68 |
69 // Used only for pairing host authenticators. | 69 // Used only for pairing host authenticators. |
70 scoped_refptr<PairingRegistry> pairing_registry_; | 70 scoped_refptr<PairingRegistry> pairing_registry_; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); | 72 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); |
73 }; | 73 }; |
74 | 74 |
75 } // namespace protocol | 75 } // namespace protocol |
76 } // namespace remoting | 76 } // namespace remoting |
77 | 77 |
78 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 78 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
OLD | NEW |