| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "net/base/net_errors.h" | 6 #include "net/base/net_errors.h" |
| 7 #include "remoting/base/rsa_key_pair.h" | 7 #include "remoting/base/rsa_key_pair.h" |
| 8 #include "remoting/protocol/authenticator_test_base.h" | 8 #include "remoting/protocol/authenticator_test_base.h" |
| 9 #include "remoting/protocol/channel_authenticator.h" | 9 #include "remoting/protocol/channel_authenticator.h" |
| 10 #include "remoting/protocol/connection_tester.h" | 10 #include "remoting/protocol/connection_tester.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 pairing_registry_); | 63 pairing_registry_); |
| 64 | 64 |
| 65 std::vector<AuthenticationMethod> methods; | 65 std::vector<AuthenticationMethod> methods; |
| 66 methods.push_back(AuthenticationMethod::Spake2Pair()); | 66 methods.push_back(AuthenticationMethod::Spake2Pair()); |
| 67 methods.push_back(AuthenticationMethod::Spake2( | 67 methods.push_back(AuthenticationMethod::Spake2( |
| 68 AuthenticationMethod::HMAC_SHA256)); | 68 AuthenticationMethod::HMAC_SHA256)); |
| 69 if (!client_hmac_only) { | 69 if (!client_hmac_only) { |
| 70 methods.push_back(AuthenticationMethod::Spake2( | 70 methods.push_back(AuthenticationMethod::Spake2( |
| 71 AuthenticationMethod::NONE)); | 71 AuthenticationMethod::NONE)); |
| 72 } | 72 } |
| 73 bool pairing_expected = pairing_registry_.get() != NULL; | 73 bool pairing_expected = pairing_registry_.get() != nullptr; |
| 74 FetchSecretCallback fetch_secret_callback = | 74 FetchSecretCallback fetch_secret_callback = |
| 75 base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, | 75 base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, |
| 76 client_interactive_pin, | 76 client_interactive_pin, |
| 77 pairing_expected); | 77 pairing_expected); |
| 78 client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator( | 78 client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator( |
| 79 client_id, client_paired_secret, | 79 client_id, client_paired_secret, |
| 80 kTestHostId, fetch_secret_callback, | 80 kTestHostId, fetch_secret_callback, |
| 81 nullptr, methods); | 81 nullptr, methods); |
| 82 client_.reset(client_as_negotiating_authenticator_); | 82 client_.reset(client_as_negotiating_authenticator_); |
| 83 } | 83 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void VerifyAccepted(const AuthenticationMethod& expected_method) { | 115 void VerifyAccepted(const AuthenticationMethod& expected_method) { |
| 116 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 116 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
| 117 | 117 |
| 118 ASSERT_EQ(Authenticator::ACCEPTED, host_->state()); | 118 ASSERT_EQ(Authenticator::ACCEPTED, host_->state()); |
| 119 ASSERT_EQ(Authenticator::ACCEPTED, client_->state()); | 119 ASSERT_EQ(Authenticator::ACCEPTED, client_->state()); |
| 120 | 120 |
| 121 client_auth_ = client_->CreateChannelAuthenticator(); | 121 client_auth_ = client_->CreateChannelAuthenticator(); |
| 122 host_auth_ = host_->CreateChannelAuthenticator(); | 122 host_auth_ = host_->CreateChannelAuthenticator(); |
| 123 RunChannelAuth(false); | 123 RunChannelAuth(false); |
| 124 | 124 |
| 125 EXPECT_TRUE(client_socket_.get() != NULL); | 125 EXPECT_TRUE(client_socket_.get() != nullptr); |
| 126 EXPECT_TRUE(host_socket_.get() != NULL); | 126 EXPECT_TRUE(host_socket_.get() != nullptr); |
| 127 | 127 |
| 128 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), | 128 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
| 129 kMessageSize, kMessages); | 129 kMessageSize, kMessages); |
| 130 | 130 |
| 131 tester.Start(); | 131 tester.Start(); |
| 132 message_loop_.Run(); | 132 message_loop_.Run(); |
| 133 tester.CheckResults(); | 133 tester.CheckResults(); |
| 134 EXPECT_EQ( | 134 EXPECT_EQ( |
| 135 expected_method, | 135 expected_method, |
| 136 client_as_negotiating_authenticator_->current_method_for_testing()); | 136 client_as_negotiating_authenticator_->current_method_for_testing()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 CreatePairingRegistry(true); | 246 CreatePairingRegistry(true); |
| 247 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( | 247 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
| 248 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, | 248 kTestClientId, kTestPairedSecretBad, kTestPinBad, kTestPin, |
| 249 AuthenticationMethod::HMAC_SHA256, false)); | 249 AuthenticationMethod::HMAC_SHA256, false)); |
| 250 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 250 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
| 251 VerifyRejected(Authenticator::INVALID_CREDENTIALS); | 251 VerifyRejected(Authenticator::INVALID_CREDENTIALS); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace protocol | 254 } // namespace protocol |
| 255 } // namespace remoting | 255 } // namespace remoting |
| OLD | NEW |