diff options
Diffstat (limited to 'remoting/client/plugin/chromoting_instance.cc')
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 1365821..e0ca0d5 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -579,26 +579,24 @@ void ChromotingInstance::SetCursorShape( } void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { + protocol::ClientAuthenticationConfig client_auth_config; + std::string local_jid; std::string host_jid; std::string host_public_key; - std::string authentication_tag; if (!data.GetString("hostJid", &host_jid) || !data.GetString("hostPublicKey", &host_public_key) || !data.GetString("localJid", &local_jid) || - !data.GetString("authenticationTag", &authentication_tag)) { + !data.GetString("hostId", &client_auth_config.host_id)) { LOG(ERROR) << "Invalid connect() data."; return; } - std::string client_pairing_id; - data.GetString("clientPairingId", &client_pairing_id); - std::string client_paired_secret; - data.GetString("clientPairedSecret", &client_paired_secret); + data.GetString("clientPairingId", &client_auth_config.pairing_client_id); + data.GetString("clientPairedSecret", &client_auth_config.pairing_secret); - protocol::FetchSecretCallback fetch_secret_callback; if (use_async_pin_dialog_) { - fetch_secret_callback = base::Bind( + client_auth_config.fetch_secret_callback = base::Bind( &ChromotingInstance::FetchSecretFromDialog, weak_factory_.GetWeakPtr()); } else { std::string shared_secret; @@ -606,10 +604,14 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { LOG(ERROR) << "sharedSecret not specified in connect()."; return; } - fetch_secret_callback = + client_auth_config.fetch_secret_callback = base::Bind(&ChromotingInstance::FetchSecretFromString, shared_secret); } + client_auth_config.fetch_third_party_token_callback = + base::Bind(&ChromotingInstance::FetchThirdPartyToken, + weak_factory_.GetWeakPtr(), host_public_key); + // Read the list of capabilities, if any. std::string capabilities; if (data.HasKey("capabilities")) { @@ -695,16 +697,6 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { protocol::NetworkSettings::NAT_TRAVERSAL_FULL), protocol::TransportRole::CLIENT)); - // Create Authenticator. - protocol::FetchThirdPartyTokenCallback fetch_third_party_token_callback = - base::Bind(&ChromotingInstance::FetchThirdPartyToken, - weak_factory_.GetWeakPtr(), host_public_key); - - scoped_ptr<protocol::Authenticator> authenticator( - new protocol::NegotiatingClientAuthenticator( - client_pairing_id, client_paired_secret, authentication_tag, - fetch_secret_callback, fetch_third_party_token_callback)); - scoped_ptr<protocol::CandidateSessionConfig> config = protocol::CandidateSessionConfig::CreateDefault(); if (std::find(experiments_list.begin(), experiments_list.end(), "vp9") != @@ -714,8 +706,8 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { client_->set_protocol_config(std::move(config)); // Kick off the connection. - client_->Start(signal_strategy_.get(), std::move(authenticator), - transport_context, host_jid, capabilities); + client_->Start(signal_strategy_.get(), client_auth_config, transport_context, + host_jid, capabilities); // Connect the input pipeline to the protocol stub. mouse_input_filter_.set_input_stub(client_->input_stub()); |