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