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