| 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 #include "remoting/protocol/it2me_host_authenticator_factory.h" | 5 #include "remoting/protocol/it2me_host_authenticator_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "crypto/rsa_private_key.h" | 8 #include "crypto/rsa_private_key.h" |
| 9 #include "remoting/protocol/v1_authenticator.h" | |
| 10 #include "remoting/protocol/negotiating_authenticator.h" | 9 #include "remoting/protocol/negotiating_authenticator.h" |
| 11 | 10 |
| 12 namespace remoting { | 11 namespace remoting { |
| 13 namespace protocol { | 12 namespace protocol { |
| 14 | 13 |
| 15 It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory( | 14 It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory( |
| 16 const std::string& local_cert, | 15 const std::string& local_cert, |
| 17 const crypto::RSAPrivateKey& local_private_key, | 16 const crypto::RSAPrivateKey& local_private_key, |
| 18 const std::string& shared_secret) | 17 const std::string& shared_secret) |
| 19 : local_cert_(local_cert), | 18 : local_cert_(local_cert), |
| 20 local_private_key_(local_private_key.Copy()), | 19 local_private_key_(local_private_key.Copy()), |
| 21 shared_secret_(shared_secret) { | 20 shared_secret_(shared_secret) { |
| 22 } | 21 } |
| 23 | 22 |
| 24 It2MeHostAuthenticatorFactory::~It2MeHostAuthenticatorFactory() { | 23 It2MeHostAuthenticatorFactory::~It2MeHostAuthenticatorFactory() { |
| 25 } | 24 } |
| 26 | 25 |
| 27 scoped_ptr<Authenticator> It2MeHostAuthenticatorFactory::CreateAuthenticator( | 26 scoped_ptr<Authenticator> It2MeHostAuthenticatorFactory::CreateAuthenticator( |
| 28 const std::string& local_jid, | 27 const std::string& local_jid, |
| 29 const std::string& remote_jid, | 28 const std::string& remote_jid, |
| 30 const buzz::XmlElement* first_message) { | 29 const buzz::XmlElement* first_message) { |
| 31 if (NegotiatingAuthenticator::IsNegotiableMessage(first_message)) { | 30 return NegotiatingAuthenticator::CreateForHost( |
| 32 return NegotiatingAuthenticator::CreateForHost( | 31 local_cert_, *local_private_key_, shared_secret_, |
| 33 local_cert_, *local_private_key_, shared_secret_, | 32 AuthenticationMethod::NONE); |
| 34 AuthenticationMethod::NONE); | |
| 35 } | |
| 36 | |
| 37 return scoped_ptr<Authenticator>(new V1HostAuthenticator( | |
| 38 local_cert_, *local_private_key_, shared_secret_, remote_jid)); | |
| 39 } | 33 } |
| 40 | 34 |
| 41 } // namespace protocol | 35 } // namespace protocol |
| 42 } // namespace remoting | 36 } // namespace remoting |
| OLD | NEW |