summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 19:01:08 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 19:01:08 +0000
commit722d8eab5034806b347a17cd5c6a10a98feb35f9 (patch)
tree5f9ae56c70ae1a815a519e1f6de652560138da55 /remoting/host
parentc551e2fcd56d5c05305414d6384aa74a359e22df (diff)
downloadchromium_src-722d8eab5034806b347a17cd5c6a10a98feb35f9.zip
chromium_src-722d8eab5034806b347a17cd5c6a10a98feb35f9.tar.gz
chromium_src-722d8eab5034806b347a17cd5c6a10a98feb35f9.tar.bz2
Token-based authentication for chromoting.
BUG=none TEST=none Review URL: http://codereview.chromium.org/2749004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/simple_host.cc8
-rw-r--r--remoting/host/simple_host.h4
-rw-r--r--remoting/host/simple_host_process.cc21
3 files changed, 16 insertions, 17 deletions
diff --git a/remoting/host/simple_host.cc b/remoting/host/simple_host.cc
index 945b663..8455ff5 100644
--- a/remoting/host/simple_host.cc
+++ b/remoting/host/simple_host.cc
@@ -6,6 +6,7 @@
#include "base/stl_util-inl.h"
#include "build/build_config.h"
+#include "remoting/base/constants.h"
#include "remoting/base/protocol_decoder.h"
#include "remoting/host/session_manager.h"
#include "remoting/jingle_glue/jingle_channel.h"
@@ -13,14 +14,14 @@
namespace remoting {
SimpleHost::SimpleHost(const std::string& username,
- const std::string& password,
+ const std::string& auth_token,
Capturer* capturer,
Encoder* encoder,
EventExecutor* executor)
: capture_thread_("CaptureThread"),
encode_thread_("EncodeThread"),
username_(username),
- password_(password),
+ auth_token_(auth_token),
capturer_(capturer),
encoder_(encoder),
executor_(executor) {
@@ -59,7 +60,8 @@ void SimpleHost::RegisterHost() {
// Connect to the talk network with a JingleClient.
jingle_client_ = new JingleClient();
- jingle_client_->Init(username_, password_, this);
+ jingle_client_->Init(username_, auth_token_,
+ kChromotingTokenServiceName, this);
}
// This method is called if a client is connected to this object.
diff --git a/remoting/host/simple_host.h b/remoting/host/simple_host.h
index 760256a..7f9227a 100644
--- a/remoting/host/simple_host.h
+++ b/remoting/host/simple_host.h
@@ -47,7 +47,7 @@ class SimpleHost : public base::RefCountedThreadSafe<SimpleHost>,
public ClientConnection::EventHandler,
public JingleClient::Callback {
public:
- SimpleHost(const std::string& username, const std::string& password,
+ SimpleHost(const std::string& username, const std::string& auth_token,
Capturer* capturer, Encoder* encoder, EventExecutor* executor);
// Run the host porcess. This method returns only after the message loop
@@ -96,7 +96,7 @@ class SimpleHost : public base::RefCountedThreadSafe<SimpleHost>,
base::Thread encode_thread_;
std::string username_;
- std::string password_;
+ std::string auth_token_;
// Capturer to be used by SessionManager. Once the SessionManager is
// constructed this is set to NULL.
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index e3ed694..d4abc40 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -75,16 +75,13 @@ int main(int argc, char** argv) {
fake = true;
}
- // Prompt user for username and password.
+ // Prompt user for username and auth token.
std::string username;
std::cout << "JID: ";
std::cin >> username;
- std::string password;
- SetConsoleEcho(false);
- std::cout << "Password: ";
- std::cin >> password;
- SetConsoleEcho(true);
- std::cout << std::endl;
+ std::string auth_token;
+ std::cout << "Auth Token: ";
+ std::cin >> auth_token;
scoped_ptr<remoting::Capturer> capturer;
scoped_ptr<remoting::Encoder> encoder;
@@ -106,13 +103,13 @@ int main(int argc, char** argv) {
capturer.reset(new remoting::CapturerFake());
}
- // Construct a simple host with username and password.
+ // Construct a simple host with username and auth_token.
// TODO(hclam): Allow the host to load saved credentials.
scoped_refptr<remoting::SimpleHost> host
- = new remoting::SimpleHost(username, password,
- capturer.release(),
- encoder.release(),
- executor.release());
+ = new remoting::SimpleHost(username, auth_token,
+ capturer.release(),
+ encoder.release(),
+ executor.release());
host->Run();
return 0;
}