| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/third_party_host_authenticator.h" | 5 #include "remoting/protocol/third_party_host_authenticator.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
| 12 #include "remoting/base/rsa_key_pair.h" | 12 #include "remoting/base/rsa_key_pair.h" |
| 13 #include "remoting/protocol/token_validator.h" | 13 #include "remoting/protocol/token_validator.h" |
| 14 #include "remoting/protocol/v2_authenticator.h" | 14 #include "remoting/protocol/v2_authenticator.h" |
| 15 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 15 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 16 | 16 |
| 17 namespace remoting { | 17 namespace remoting { |
| 18 namespace protocol { | 18 namespace protocol { |
| 19 | 19 |
| 20 ThirdPartyHostAuthenticator::ThirdPartyHostAuthenticator( | 20 ThirdPartyHostAuthenticator::ThirdPartyHostAuthenticator( |
| 21 const std::string& local_cert, | 21 const std::string& local_cert, |
| 22 scoped_refptr<RsaKeyPair> key_pair, | 22 scoped_refptr<RsaKeyPair> key_pair, |
| 23 scoped_ptr<TokenValidator> token_validator) | 23 scoped_ptr<TokenValidator> token_validator) |
| 24 : ThirdPartyAuthenticatorBase(MESSAGE_READY), | 24 : ThirdPartyAuthenticatorBase(MESSAGE_READY), |
| 25 local_cert_(local_cert), | 25 local_cert_(local_cert), |
| 26 key_pair_(key_pair), | 26 key_pair_(key_pair), |
| 27 token_validator_(token_validator.Pass()) { | 27 token_validator_(std::move(token_validator)) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 ThirdPartyHostAuthenticator::~ThirdPartyHostAuthenticator() { | 30 ThirdPartyHostAuthenticator::~ThirdPartyHostAuthenticator() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 void ThirdPartyHostAuthenticator::ProcessTokenMessage( | 33 void ThirdPartyHostAuthenticator::ProcessTokenMessage( |
| 34 const buzz::XmlElement* message, | 34 const buzz::XmlElement* message, |
| 35 const base::Closure& resume_callback) { | 35 const base::Closure& resume_callback) { |
| 36 // Host has already sent the URL and expects a token from the client. | 36 // Host has already sent the URL and expects a token from the client. |
| 37 std::string token = message->TextNamed(kTokenTag); | 37 std::string token = message->TextNamed(kTokenTag); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 // The other side already started the SPAKE authentication. | 87 // The other side already started the SPAKE authentication. |
| 88 token_state_ = ACCEPTED; | 88 token_state_ = ACCEPTED; |
| 89 underlying_ = V2Authenticator::CreateForHost( | 89 underlying_ = V2Authenticator::CreateForHost( |
| 90 local_cert_, key_pair_, shared_secret, WAITING_MESSAGE); | 90 local_cert_, key_pair_, shared_secret, WAITING_MESSAGE); |
| 91 underlying_->ProcessMessage(message, resume_callback); | 91 underlying_->ProcessMessage(message, resume_callback); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace protocol | 94 } // namespace protocol |
| 95 } // namespace remoting | 95 } // namespace remoting |
| OLD | NEW |