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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 std::vector<AuthenticationMethod> methods; | 55 std::vector<AuthenticationMethod> methods; |
56 methods.push_back(AuthenticationMethod::Spake2( | 56 methods.push_back(AuthenticationMethod::Spake2( |
57 AuthenticationMethod::HMAC_SHA256)); | 57 AuthenticationMethod::HMAC_SHA256)); |
58 if (!client_hmac_only) { | 58 if (!client_hmac_only) { |
59 methods.push_back(AuthenticationMethod::Spake2( | 59 methods.push_back(AuthenticationMethod::Spake2( |
60 AuthenticationMethod::NONE)); | 60 AuthenticationMethod::NONE)); |
61 } | 61 } |
62 client_.reset(new NegotiatingClientAuthenticator( | 62 client_.reset(new NegotiatingClientAuthenticator( |
63 kTestHostId, base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, | 63 kTestHostId, base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, |
64 client_secret), methods)); | 64 client_secret), |
| 65 scoped_ptr<ThirdPartyClientAuthenticator::TokenFetcher>(), methods)); |
65 } | 66 } |
66 | 67 |
67 static void FetchSecret( | 68 static void FetchSecret( |
68 const std::string& client_secret, | 69 const std::string& client_secret, |
69 const protocol::SecretFetchedCallback& secret_fetched_callback) { | 70 const protocol::SecretFetchedCallback& secret_fetched_callback) { |
70 secret_fetched_callback.Run(client_secret); | 71 secret_fetched_callback.Run(client_secret); |
71 } | 72 } |
72 void VerifyRejected(Authenticator::RejectionReason reason) { | 73 void VerifyRejected(Authenticator::RejectionReason reason) { |
73 ASSERT_TRUE((client_->state() == Authenticator::REJECTED && | 74 ASSERT_TRUE((client_->state() == Authenticator::REJECTED && |
74 (client_->rejection_reason() == reason)) || | 75 (client_->rejection_reason() == reason)) || |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( | 138 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
138 kTestSharedSecret, kTestSharedSecretBad, | 139 kTestSharedSecret, kTestSharedSecretBad, |
139 AuthenticationMethod::NONE, true)); | 140 AuthenticationMethod::NONE, true)); |
140 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 141 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
141 | 142 |
142 VerifyRejected(Authenticator::PROTOCOL_ERROR); | 143 VerifyRejected(Authenticator::PROTOCOL_ERROR); |
143 } | 144 } |
144 | 145 |
145 } // namespace protocol | 146 } // namespace protocol |
146 } // namespace remoting | 147 } // namespace remoting |
OLD | NEW |