diff options
author | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-09 21:10:24 +0000 |
---|---|---|
committer | jamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-09 21:10:24 +0000 |
commit | aa11e68e26aed006d1de1a9d3048c700f9eda67f (patch) | |
tree | 54d3c09134deb00de378e6113167554636b9643c /remoting/client | |
parent | 259288ece97fec815c6055144798d5ea101d25d2 (diff) | |
download | chromium_src-aa11e68e26aed006d1de1a9d3048c700f9eda67f.zip chromium_src-aa11e68e26aed006d1de1a9d3048c700f9eda67f.tar.gz chromium_src-aa11e68e26aed006d1de1a9d3048c700f9eda67f.tar.bz2 |
Added nonce to client interface.
BUG=None.
TEST=Chromoting isn't broken.
Review URL: http://codereview.chromium.org/6956010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r-- | remoting/client/appengine/static_files/chromoting_session.js | 6 | ||||
-rw-r--r-- | remoting/client/chromoting_client.cc | 8 | ||||
-rw-r--r-- | remoting/client/client_config.h | 3 | ||||
-rw-r--r-- | remoting/client/client_util.cc | 4 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 7 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.h | 3 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_scriptable_object.cc | 24 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_scriptable_object.h | 5 |
8 files changed, 42 insertions, 18 deletions
diff --git a/remoting/client/appengine/static_files/chromoting_session.js b/remoting/client/appengine/static_files/chromoting_session.js index 65ef2a3..908e5e3 100644 --- a/remoting/client/appengine/static_files/chromoting_session.js +++ b/remoting/client/appengine/static_files/chromoting_session.js @@ -47,7 +47,8 @@ function registerConnection() { var clientjid = xhr.responseText; chromoting.plugin.sendIq = sendIq; - chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid); + // TODO:(jamiewalch): Pass in the correct nonce. + chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid, ''); // TODO(ajwong): This should just be feedIq(); window.setTimeout(feedIq, 1000); window.setTimeout(updateStatusBarStats, 1000); @@ -125,8 +126,9 @@ function init() { if (chromoting.connectMethod == "sandboxed") { registerConnection(); } else { + // TODO:(jamiewalch): Pass in the correct nonce. plugin.connect(chromoting.username, chromoting.hostjid, - chromoting.xmppAuthToken); + chromoting.xmppAuthToken, ''); window.setTimeout("updateStatusBarStats()", 1000); } } else { diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index 697245c..3836776 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -46,7 +46,7 @@ void ChromotingClient::Start() { } connection_->Connect(config_.username, config_.auth_token, config_.host_jid, - this, this, this); + config_.nonce, this, this, this); if (!view_->Initialize()) { ClientDone(); @@ -66,8 +66,8 @@ void ChromotingClient::StartSandboxed(scoped_refptr<XmppProxy> xmpp_proxy, return; } - connection_->ConnectSandboxed(xmpp_proxy, your_jid, host_jid, this, this, - this); + connection_->ConnectSandboxed(xmpp_proxy, your_jid, host_jid, config_.nonce, + this, this, this); if (!view_->Initialize()) { ClientDone(); diff --git a/remoting/client/client_config.h b/remoting/client/client_config.h index 2546ae4..50c9f3f 100644 --- a/remoting/client/client_config.h +++ b/remoting/client/client_config.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,7 @@ struct ClientConfig { std::string host_jid; std::string username; std::string auth_token; + std::string nonce; }; } // namespace remoting diff --git a/remoting/client/client_util.cc b/remoting/client/client_util.cc index 6d241ac..1f1d16a 100644 --- a/remoting/client/client_util.cc +++ b/remoting/client/client_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -61,6 +61,8 @@ bool GetLoginInfoFromArgs(int argc, char** argv, ClientConfig* config) { !found_auth_token) return false; + NOTIMPLEMENTED() << "Nonce ignored."; + config->host_jid = host_jid; config->username = username; config->auth_token = auth_token; diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 270a71e..ae342b3 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -130,7 +130,8 @@ void ChromotingInstance::Connect(const ClientConfig& config) { } void ChromotingInstance::ConnectSandboxed(const std::string& your_jid, - const std::string& host_jid) { + const std::string& host_jid, + const std::string& nonce) { // TODO(ajwong): your_jid and host_jid should be moved into ClientConfig. In // fact, this whole function should go away, and Connect() should just look at // ClientConfig. @@ -145,7 +146,9 @@ void ChromotingInstance::ConnectSandboxed(const std::string& your_jid, context_.jingle_thread()->message_loop()); scriptable_object->AttachXmppProxy(xmpp_proxy); - client_.reset(new ChromotingClient(ClientConfig(), + ClientConfig config_; + config_.nonce = nonce; + client_.reset(new ChromotingClient(config_, &context_, host_connection_.get(), view_proxy_, diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index 23d9ca2..c1c68d6 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -64,7 +64,8 @@ class ChromotingInstance : public pp::Instance { virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); virtual void Connect(const ClientConfig& config); virtual void ConnectSandboxed(const std::string& your_jid, - const std::string& host_jid); + const std::string& host_jid, + const std::string& nonce); virtual bool HandleInputEvent(const PP_InputEvent& event); virtual void Disconnect(); virtual pp::Var GetInstanceObject(); diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc index a12ec53..106141f 100644 --- a/remoting/client/plugin/chromoting_scriptable_object.cc +++ b/remoting/client/plugin/chromoting_scriptable_object.cc @@ -332,7 +332,7 @@ void ChromotingScriptableObject::SendIq(const std::string& message_xml) { Var ChromotingScriptableObject::DoConnect(const std::vector<Var>& args, Var* exception) { - if (args.size() != 3) { + if (args.size() != 4) { *exception = Var("Usage: connect(username, host_jid, auth_token)"); return Var(); } @@ -357,6 +357,12 @@ Var ChromotingScriptableObject::DoConnect(const std::vector<Var>& args, } config.auth_token = args[2].AsString(); + if (!args[3].is_string()) { + *exception = Var("nonce must be a string."); + return Var(); + } + config.nonce = args[3].AsString(); + LogDebugInfo("Connecting to host."); instance_->Connect(config); @@ -365,8 +371,8 @@ Var ChromotingScriptableObject::DoConnect(const std::vector<Var>& args, Var ChromotingScriptableObject::DoConnectSandboxed( const std::vector<Var>& args, Var* exception) { - if (args.size() != 2) { - *exception = Var("Usage: connectSandboxed(your_jid, host_jid)"); + if (args.size() != 3) { + *exception = Var("Usage: connectSandboxed(your_jid, host_jid, nonce)"); return Var(); } @@ -384,8 +390,16 @@ Var ChromotingScriptableObject::DoConnectSandboxed( } host_jid = args[1].AsString(); - VLOG(1) << "your_jid: " << your_jid << " and host_jid: " << host_jid; - instance_->ConnectSandboxed(your_jid, host_jid); + std::string nonce; + if (!args[2].is_string()) { + *exception = Var("nonce must be a string."); + return Var(); + } + nonce = args[2].AsString(); + + VLOG(1) << "your_jid: " << your_jid << ", host_jid: " << host_jid + << ", nonce: " << nonce; + instance_->ConnectSandboxed(your_jid, host_jid, nonce); return Var(); } diff --git a/remoting/client/plugin/chromoting_scriptable_object.h b/remoting/client/plugin/chromoting_scriptable_object.h index 317d90f..8ee2d12f 100644 --- a/remoting/client/plugin/chromoting_scriptable_object.h +++ b/remoting/client/plugin/chromoting_scriptable_object.h @@ -77,8 +77,9 @@ // // Either use connect() or connectSandboxed(), not both. If using // // connectSandboxed(), sendIq must be set, and responses to calls on // // sendIq must be piped back into onIq(). -// void connect(string username, string host_jid, string auth_token); -// void connectSandboxed(); +// void connect(string username, string host_jid, string auth_token, +// string nonce); +// void connectSandboxed(string your_jid, string host_jid, string nonce); // void disconnect(); // // // Method for submitting login information. |