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/negotiating_host_authenticator.h" | 5 #include "remoting/protocol/negotiating_host_authenticator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
14 #include "remoting/base/rsa_key_pair.h" | 14 #include "remoting/base/rsa_key_pair.h" |
15 #include "remoting/protocol/channel_authenticator.h" | 15 #include "remoting/protocol/channel_authenticator.h" |
16 #include "remoting/protocol/pairing_host_authenticator.h" | 16 #include "remoting/protocol/pairing_host_authenticator.h" |
17 #include "remoting/protocol/pairing_registry.h" | 17 #include "remoting/protocol/pairing_registry.h" |
| 18 #include "remoting/protocol/token_validator.h" |
18 #include "remoting/protocol/v2_authenticator.h" | 19 #include "remoting/protocol/v2_authenticator.h" |
19 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 20 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
20 | 21 |
21 namespace remoting { | 22 namespace remoting { |
22 namespace protocol { | 23 namespace protocol { |
23 | 24 |
24 NegotiatingHostAuthenticator::NegotiatingHostAuthenticator( | 25 NegotiatingHostAuthenticator::NegotiatingHostAuthenticator( |
25 const std::string& local_cert, | 26 const std::string& local_cert, |
26 scoped_refptr<RsaKeyPair> key_pair) | 27 scoped_refptr<RsaKeyPair> key_pair) |
27 : NegotiatingAuthenticatorBase(WAITING_MESSAGE), | 28 : NegotiatingAuthenticatorBase(WAITING_MESSAGE), |
(...skipping 17 matching lines...) Expand all Loading... |
45 result->AddMethod(AuthenticationMethod::Spake2Pair()); | 46 result->AddMethod(AuthenticationMethod::Spake2Pair()); |
46 } | 47 } |
47 return scoped_ptr<Authenticator>(result.Pass()); | 48 return scoped_ptr<Authenticator>(result.Pass()); |
48 } | 49 } |
49 | 50 |
50 // static | 51 // static |
51 scoped_ptr<Authenticator> | 52 scoped_ptr<Authenticator> |
52 NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( | 53 NegotiatingHostAuthenticator::CreateWithThirdPartyAuth( |
53 const std::string& local_cert, | 54 const std::string& local_cert, |
54 scoped_refptr<RsaKeyPair> key_pair, | 55 scoped_refptr<RsaKeyPair> key_pair, |
55 scoped_ptr<ThirdPartyHostAuthenticator::TokenValidator> token_validator) { | 56 scoped_ptr<TokenValidator> token_validator) { |
56 scoped_ptr<NegotiatingHostAuthenticator> result( | 57 scoped_ptr<NegotiatingHostAuthenticator> result( |
57 new NegotiatingHostAuthenticator(local_cert, key_pair)); | 58 new NegotiatingHostAuthenticator(local_cert, key_pair)); |
58 result->token_validator_ = token_validator.Pass(); | 59 result->token_validator_ = token_validator.Pass(); |
59 result->AddMethod(AuthenticationMethod::ThirdParty()); | 60 result->AddMethod(AuthenticationMethod::ThirdParty()); |
60 return scoped_ptr<Authenticator>(result.Pass()); | 61 return scoped_ptr<Authenticator>(result.Pass()); |
61 } | 62 } |
62 | 63 |
63 NegotiatingHostAuthenticator::~NegotiatingHostAuthenticator() { | 64 NegotiatingHostAuthenticator::~NegotiatingHostAuthenticator() { |
64 } | 65 } |
65 | 66 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 current_method_.type() == AuthenticationMethod::SPAKE2_PAIR); | 181 current_method_.type() == AuthenticationMethod::SPAKE2_PAIR); |
181 current_authenticator_ = V2Authenticator::CreateForHost( | 182 current_authenticator_ = V2Authenticator::CreateForHost( |
182 local_cert_, local_key_pair_, shared_secret_hash_, | 183 local_cert_, local_key_pair_, shared_secret_hash_, |
183 preferred_initial_state); | 184 preferred_initial_state); |
184 } | 185 } |
185 resume_callback.Run(); | 186 resume_callback.Run(); |
186 } | 187 } |
187 | 188 |
188 } // namespace protocol | 189 } // namespace protocol |
189 } // namespace remoting | 190 } // namespace remoting |
OLD | NEW |