summaryrefslogtreecommitdiffstats
path: root/remoting/protocol
diff options
context:
space:
mode:
authoralexmos <alexmos@chromium.org>2016-03-11 15:46:59 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-11 23:48:23 +0000
commitd2243b6ff9ae51e78fb99b23563ecb5879848a2a (patch)
treed55faac9a2d08a776abcc8dd93a4fa1afbd6b60c /remoting/protocol
parentcbb99d9120a6e285b7d770fdb606110430bc8453 (diff)
downloadchromium_src-d2243b6ff9ae51e78fb99b23563ecb5879848a2a.zip
chromium_src-d2243b6ff9ae51e78fb99b23563ecb5879848a2a.tar.gz
chromium_src-d2243b6ff9ae51e78fb99b23563ecb5879848a2a.tar.bz2
Revert of Move NegotiatingClientAuthentication creation to ChromotingClient. (patchset #2 id:40001 of https://codereview.chromium.org/1778023002/ )
Reason for revert: Appears to be breaking compile on Linux and Mac: https://build.chromium.org/p/chromium/builders/Linux/builds/72875 https://build.chromium.org/p/chromium/builders/Mac/builds/13060 Output: FAILED: /b/build/slave/Linux/build/src/build/goma/client/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ ... -c ../../remoting/test/chromoting_test_fixture.cc -o obj/remoting/test/chromoting_test_driver.chromoting_test_fixture.o In file included from ../../remoting/test/chromoting_test_fixture.cc:14: In file included from ../../remoting/test/test_chromoting_client.h:14: In file included from ../../remoting/client/chromoting_client.h:19: In file included from ../../remoting/protocol/negotiating_client_authenticator.h:15: In file included from ../../remoting/protocol/negotiating_authenticator_base.h:16: ../../third_party/webrtc/libjingle/xmllite/xmlelement.h:17:10: fatal error: 'webrtc/libjingle/xmllite/qname.h' file not found #include "webrtc/libjingle/xmllite/qname.h" ^ 1 error generated. ninja: build stopped: subcommand failed. Original issue's description: > Move NegotiatingClientAuthentication creation to ChromotingClient. > > For the new SPAKE2 authenticator we need to pass client_jid > to the authenticator. This wasn't possible previously because > NegotiatingClientAuthenticator was created before signaling is > connected. Moved NegotiatingClientAuthentication creation to > ChromotingClient. > > BUG=589698 > > Committed: https://crrev.com/279bf7c76a3e0bfbbd28748d0d02fcead88f4436 > Cr-Commit-Position: refs/heads/master@{#380779} TBR=jamiewalch@chromium.org,sergeyu@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=589698 Review URL: https://codereview.chromium.org/1788943002 Cr-Commit-Position: refs/heads/master@{#380785}
Diffstat (limited to 'remoting/protocol')
-rw-r--r--remoting/protocol/negotiating_authenticator_unittest.cc15
-rw-r--r--remoting/protocol/negotiating_client_authenticator.cc31
-rw-r--r--remoting/protocol/negotiating_client_authenticator.h41
3 files changed, 44 insertions, 43 deletions
diff --git a/remoting/protocol/negotiating_authenticator_unittest.cc b/remoting/protocol/negotiating_authenticator_unittest.cc
index 534eecc..0161e65 100644
--- a/remoting/protocol/negotiating_authenticator_unittest.cc
+++ b/remoting/protocol/negotiating_authenticator_unittest.cc
@@ -65,17 +65,14 @@ class NegotiatingAuthenticatorTest : public AuthenticatorTestBase {
host_cert_, key_pair_, host_secret_hash, pairing_registry_);
}
-
- protocol::ClientAuthenticationConfig client_auth_config;
- client_auth_config.host_id = kTestHostId;
- client_auth_config.pairing_client_id = client_id;
- client_auth_config.pairing_secret= client_paired_secret;
bool pairing_expected = pairing_registry_.get() != nullptr;
- client_auth_config.fetch_secret_callback =
+ FetchSecretCallback fetch_secret_callback =
base::Bind(&NegotiatingAuthenticatorTest::FetchSecret,
- client_interactive_pin, pairing_expected);
- client_as_negotiating_authenticator_ =
- new NegotiatingClientAuthenticator(client_auth_config);
+ client_interactive_pin,
+ pairing_expected);
+ client_as_negotiating_authenticator_ = new NegotiatingClientAuthenticator(
+ client_id, client_paired_secret, kTestHostId, fetch_secret_callback,
+ FetchThirdPartyTokenCallback());
client_.reset(client_as_negotiating_authenticator_);
}
diff --git a/remoting/protocol/negotiating_client_authenticator.cc b/remoting/protocol/negotiating_client_authenticator.cc
index 11dd49a..c6cda5d 100644
--- a/remoting/protocol/negotiating_client_authenticator.cc
+++ b/remoting/protocol/negotiating_client_authenticator.cc
@@ -21,15 +21,20 @@
namespace remoting {
namespace protocol {
-ClientAuthenticationConfig::ClientAuthenticationConfig() {}
-ClientAuthenticationConfig::~ClientAuthenticationConfig() {}
-
NegotiatingClientAuthenticator::NegotiatingClientAuthenticator(
- const ClientAuthenticationConfig& config)
+ const std::string& client_pairing_id,
+ const std::string& shared_secret,
+ const std::string& authentication_tag,
+ const FetchSecretCallback& fetch_secret_callback,
+ const FetchThirdPartyTokenCallback& fetch_third_party_token_callback)
: NegotiatingAuthenticatorBase(MESSAGE_READY),
- config_(config),
+ client_pairing_id_(client_pairing_id),
+ shared_secret_(shared_secret),
+ authentication_tag_(authentication_tag),
+ fetch_secret_callback_(fetch_secret_callback),
+ fetch_third_party_token_callback_(fetch_third_party_token_callback),
weak_factory_(this) {
- if (!config_.fetch_third_party_token_callback.is_null())
+ if (!fetch_third_party_token_callback.is_null())
AddMethod(Method::THIRD_PARTY);
AddMethod(Method::SPAKE2_PAIR);
AddMethod(Method::SPAKE2_SHARED_SECRET_HMAC);
@@ -110,7 +115,7 @@ void NegotiatingClientAuthenticator::CreateAuthenticatorForCurrentMethod(
if (current_method_ == Method::THIRD_PARTY) {
current_authenticator_.reset(new ThirdPartyClientAuthenticator(
base::Bind(&V2Authenticator::CreateForClient),
- config_.fetch_third_party_token_callback));
+ fetch_third_party_token_callback_));
resume_callback.Run();
} else {
DCHECK(current_method_ == Method::SPAKE2_SHARED_SECRET_PLAIN ||
@@ -120,20 +125,20 @@ void NegotiatingClientAuthenticator::CreateAuthenticatorForCurrentMethod(
SecretFetchedCallback callback = base::Bind(
&NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret,
weak_factory_.GetWeakPtr(), preferred_initial_state, resume_callback);
- config_.fetch_secret_callback.Run(pairing_supported, callback);
+ fetch_secret_callback_.Run(pairing_supported, callback);
}
}
void NegotiatingClientAuthenticator::CreatePreferredAuthenticator() {
- if (!config_.pairing_client_id.empty() && !config_.pairing_secret.empty() &&
+ if (!client_pairing_id_.empty() && !shared_secret_.empty() &&
std::find(methods_.begin(), methods_.end(), Method::SPAKE2_PAIR) !=
methods_.end()) {
// If the client specified a pairing id and shared secret, then create a
// PairingAuthenticator.
current_authenticator_.reset(new PairingClientAuthenticator(
- config_.pairing_client_id, config_.pairing_secret,
- base::Bind(&V2Authenticator::CreateForClient),
- config_.fetch_secret_callback, config_.host_id));
+ client_pairing_id_, shared_secret_,
+ base::Bind(&V2Authenticator::CreateForClient), fetch_secret_callback_,
+ authentication_tag_));
current_method_ = Method::SPAKE2_PAIR;
}
}
@@ -145,7 +150,7 @@ void NegotiatingClientAuthenticator::CreateV2AuthenticatorWithSecret(
current_authenticator_ = V2Authenticator::CreateForClient(
(current_method_ == Method::SPAKE2_SHARED_SECRET_PLAIN)
? shared_secret
- : GetSharedSecretHash(config_.host_id, shared_secret),
+ : GetSharedSecretHash(authentication_tag_, shared_secret),
initial_state);
resume_callback.Run();
}
diff --git a/remoting/protocol/negotiating_client_authenticator.h b/remoting/protocol/negotiating_client_authenticator.h
index 0867d10..abdb58c 100644
--- a/remoting/protocol/negotiating_client_authenticator.h
+++ b/remoting/protocol/negotiating_client_authenticator.h
@@ -18,30 +18,18 @@
namespace remoting {
namespace protocol {
-struct ClientAuthenticationConfig {
- ClientAuthenticationConfig();
- ~ClientAuthenticationConfig();
-
- // Used for all authenticators.
- std::string host_id;
-
- // Used for pairing authenticators
- std::string pairing_client_id;
- std::string pairing_secret;
-
- // Used for shared secret authenticators.
- FetchSecretCallback fetch_secret_callback;
-
- // Used for third party authenticators.
- FetchThirdPartyTokenCallback fetch_third_party_token_callback;
-};
-
// Client-side implementation of NegotiatingAuthenticatorBase.
// See comments in negotiating_authenticator_base.h for a general explanation.
class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase {
public:
- explicit NegotiatingClientAuthenticator(
- const ClientAuthenticationConfig& config);
+ // TODO(jamiewalch): Pass ClientConfig instead of separate parameters.
+ NegotiatingClientAuthenticator(
+ const std::string& client_pairing_id,
+ const std::string& shared_secret,
+ const std::string& authentication_tag,
+ const FetchSecretCallback& fetch_secret_callback,
+ const FetchThirdPartyTokenCallback& fetch_third_party_token_callback);
+
~NegotiatingClientAuthenticator() override;
// Overriden from Authenticator.
@@ -76,7 +64,18 @@ class NegotiatingClientAuthenticator : public NegotiatingAuthenticatorBase {
const base::Closure& resume_callback,
const std::string& shared_secret);
- ClientAuthenticationConfig config_;
+ // Used for pairing authenticators
+ std::string client_pairing_id_;
+ std::string shared_secret_;
+
+ // Used for all authenticators.
+ std::string authentication_tag_;
+
+ // Used for shared secret authenticators.
+ FetchSecretCallback fetch_secret_callback_;
+
+ // Used for third party authenticators.
+ FetchThirdPartyTokenCallback fetch_third_party_token_callback_;
// Internal NegotiatingClientAuthenticator data.
bool method_set_by_host_ = false;