summaryrefslogtreecommitdiffstats
path: root/remoting/jingle_glue
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 19:09:11 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 19:09:11 +0000
commit6f5ec4a51a4cfc6023c094801f2f180c6739a89b (patch)
tree256f64b843183e4c1c0b525ac84b84797e038848 /remoting/jingle_glue
parentc78559eabd562359ef23585df9268eeb5119b718 (diff)
downloadchromium_src-6f5ec4a51a4cfc6023c094801f2f180c6739a89b.zip
chromium_src-6f5ec4a51a4cfc6023c094801f2f180c6739a89b.tar.gz
chromium_src-6f5ec4a51a4cfc6023c094801f2f180c6739a89b.tar.bz2
Revert 49298 - Broke compile - Token-based authentication for chromoting.
BUG=none TEST=none Review URL: http://codereview.chromium.org/2749004 TBR=sergeyu@chromium.org Review URL: http://codereview.chromium.org/2724010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/jingle_glue')
-rw-r--r--remoting/jingle_glue/jingle_client.cc49
-rw-r--r--remoting/jingle_glue/jingle_client.h19
-rw-r--r--remoting/jingle_glue/jingle_test_client.cc17
3 files changed, 35 insertions, 50 deletions
diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc
index bf6baee..66867f5 100644
--- a/remoting/jingle_glue/jingle_client.cc
+++ b/remoting/jingle_glue/jingle_client.cc
@@ -7,7 +7,6 @@
#include "base/logging.h"
#include "base/waitable_event.h"
#include "base/message_loop.h"
-#include "chrome/common/net/notifier/communicator/gaia_token_pre_xmpp_auth.h"
#include "chrome/common/net/notifier/communicator/xmpp_socket_adapter.h"
#include "remoting/jingle_glue/jingle_thread.h"
#include "remoting/jingle_glue/relay_port_allocator.h"
@@ -19,8 +18,6 @@
#include "talk/session/tunnel/securetunnelsessionclient.h"
#endif
#include "talk/session/tunnel/tunnelsessionclient.h"
-#include "talk/xmpp/prexmppauth.h"
-#include "talk/xmpp/saslcookiemechanism.h"
namespace remoting {
@@ -33,20 +30,22 @@ JingleClient::~JingleClient() {
DCHECK(state_ == CLOSED);
}
-void JingleClient::Init(
- const std::string& username, const std::string& auth_token,
- const std::string& auth_token_service, Callback* callback) {
+void JingleClient::Init(const std::string& username,
+ const std::string& password,
+ Callback* callback) {
DCHECK(username != "");
DCHECK(callback != NULL);
DCHECK(thread_ == NULL); // Init() can be called only once.
callback_ = callback;
+ username_ = username;
+ password_ = password;
+
thread_.reset(new JingleThread());
thread_->Start();
thread_->message_loop()->PostTask(
- FROM_HERE, NewRunnableMethod(this, &JingleClient::DoInitialize,
- username, auth_token, auth_token_service));
+ FROM_HERE, NewRunnableMethod(this, &JingleClient::DoInitialize));
}
class JingleClient::ConnectRequest {
@@ -109,28 +108,27 @@ void JingleClient::DoClose() {
UpdateState(CLOSED);
}
-void JingleClient::DoInitialize(const std::string& username,
- const std::string& auth_token,
- const std::string& auth_token_service) {
- buzz::Jid login_jid(username);
+void JingleClient::DoInitialize() {
+ buzz::Jid login_jid(username_);
+ talk_base::InsecureCryptStringImpl password;
+ password.password() = password_;
- buzz::XmppClientSettings settings;
- settings.set_user(login_jid.node());
- settings.set_host(login_jid.domain());
- settings.set_resource("chromoting");
- settings.set_use_tls(true);
- settings.set_token_service(auth_token_service);
- settings.set_auth_cookie(auth_token);
- settings.set_server(talk_base::SocketAddress("talk.google.com", 5222));
+ buzz::XmppClientSettings xcs;
+ xcs.set_user(login_jid.node());
+ xcs.set_host(login_jid.domain());
+ xcs.set_resource("chromoting");
+ xcs.set_use_tls(true);
+ xcs.set_pass(talk_base::CryptString(password));
+ xcs.set_server(talk_base::SocketAddress("talk.google.com", 5222));
client_ = new buzz::XmppClient(thread_->task_pump());
client_->SignalStateChange.connect(
this, &JingleClient::OnConnectionStateChanged);
buzz::AsyncSocket* socket =
- new notifier::XmppSocketAdapter(settings, false);
+ new notifier::XmppSocketAdapter(xcs, false);
- client_->Connect(settings, "", socket, CreatePreXmppAuth(settings));
+ client_->Connect(xcs, "", socket, NULL);
client_->Start();
network_manager_.reset(new talk_base::NetworkManager());
@@ -226,11 +224,4 @@ void JingleClient::UpdateState(State new_state) {
}
}
-buzz::PreXmppAuth* JingleClient::CreatePreXmppAuth(
- const buzz::XmppClientSettings& settings) {
- buzz::Jid jid(settings.user(), settings.host(), buzz::STR_EMPTY);
- return new notifier::GaiaTokenPreXmppAuth(jid.Str(), settings.auth_cookie(),
- settings.token_service());
-}
-
} // namespace remoting
diff --git a/remoting/jingle_glue/jingle_client.h b/remoting/jingle_glue/jingle_client.h
index 2a68042..56d97e1 100644
--- a/remoting/jingle_glue/jingle_client.h
+++ b/remoting/jingle_glue/jingle_client.h
@@ -16,10 +16,6 @@ namespace talk_base {
class NetworkManager;
} // namespace talk_base
-namespace buzz {
-class PreXmppAuth;
-} // namespace buzz
-
namespace cricket {
class BasicPortAllocator;
class SessionManager;
@@ -67,8 +63,9 @@ class JingleClient : public base::RefCountedThreadSafe<JingleClient>,
// only once. message_loop() is guaranteed to exist after this method returns,
// but the connection may not be open yet. |callback| specifies callback
// object for the client and must not be NULL.
- void Init(const std::string& username, const std::string& auth_token,
- const std::string& auth_token_service, Callback* callback);
+ // TODO(sergeyu): Replace password with a token.
+ void Init(const std::string& username, const std::string& password,
+ Callback* callback);
// Creates new JingleChannel connected to the host with the specified jid.
// The result is returned immediately but the channel fails if the host
@@ -104,9 +101,7 @@ class JingleClient : public base::RefCountedThreadSafe<JingleClient>,
void OnIncomingTunnel(cricket::TunnelSessionClient* client, buzz::Jid jid,
std::string description, cricket::Session* session);
- void DoInitialize(const std::string& username,
- const std::string& auth_token,
- const std::string& auth_token_service);
+ void DoInitialize();
// Used by Connect().
void DoConnect(ConnectRequest* request,
@@ -120,15 +115,13 @@ class JingleClient : public base::RefCountedThreadSafe<JingleClient>,
// the jingle thread.
void UpdateState(State new_state);
- buzz::PreXmppAuth* CreatePreXmppAuth(
- const buzz::XmppClientSettings& settings);
-
-
buzz::XmppClient* client_;
scoped_ptr<JingleThread> thread_;
State state_;
Callback* callback_;
+ std::string username_;
+ std::string password_;
Lock full_jid_lock_;
std::string full_jid_;
diff --git a/remoting/jingle_glue/jingle_test_client.cc b/remoting/jingle_glue/jingle_test_client.cc
index 7bf33c0..38677fe 100644
--- a/remoting/jingle_glue/jingle_test_client.cc
+++ b/remoting/jingle_glue/jingle_test_client.cc
@@ -15,13 +15,11 @@ extern "C" {
#include "base/at_exit.h"
#include "media/base/data_buffer.h"
-#include "remoting/base/constants.h"
#include "remoting/jingle_glue/jingle_channel.h"
#include "remoting/jingle_glue/jingle_client.h"
using remoting::JingleClient;
using remoting::JingleChannel;
-using remoting::kChromotingTokenServiceName;
void SetConsoleEcho(bool on) {
#if defined(OS_WIN)
@@ -53,10 +51,10 @@ class JingleTestClient : public JingleChannel::Callback,
public:
virtual ~JingleTestClient() {}
- void Run(const std::string& username, const std::string& auth_token,
+ void Run(const std::string& username, const std::string& password,
const std::string& host_jid) {
client_ = new JingleClient();
- client_->Init(username, auth_token, kChromotingTokenServiceName, this);
+ client_->Init(username, password, this);
if (host_jid != "") {
scoped_refptr<JingleChannel> channel = client_->Connect(host_jid, this);
@@ -146,13 +144,16 @@ int main(int argc, char** argv) {
std::cout << "JID: ";
std::cin >> username;
- std::string auth_token;
- std::cout << "Auth token: ";
- std::cin >> auth_token;
+ std::string password;
+ SetConsoleEcho(false);
+ std::cout << "Password: ";
+ std::cin >> password;
+ SetConsoleEcho(true);
+ std::cout << std::endl;
JingleTestClient client;
- client.Run(username, auth_token, host_jid);
+ client.Run(username, password, host_jid);
return 0;
}