Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: remoting/signaling/xmpp_signal_strategy.cc

Issue 959033004: Remove ClientLogin support from remoting host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/signaling/xmpp_signal_strategy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/signaling/xmpp_signal_strategy.h" 5 #include "remoting/signaling/xmpp_signal_strategy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 DCHECK(CalledOnValidThread()); 76 DCHECK(CalledOnValidThread());
77 77
78 // Disconnect first if we are currently connected. 78 // Disconnect first if we are currently connected.
79 Disconnect(); 79 Disconnect();
80 80
81 buzz::XmppClientSettings settings; 81 buzz::XmppClientSettings settings;
82 buzz::Jid login_jid(xmpp_server_config_.username); 82 buzz::Jid login_jid(xmpp_server_config_.username);
83 settings.set_user(login_jid.node()); 83 settings.set_user(login_jid.node());
84 settings.set_host(login_jid.domain()); 84 settings.set_host(login_jid.domain());
85 settings.set_resource(resource_name_); 85 settings.set_resource(resource_name_);
86 settings.set_token_service(xmpp_server_config_.auth_service); 86 settings.set_token_service("oauth2");
87 settings.set_auth_token(buzz::AUTH_MECHANISM_GOOGLE_TOKEN, 87 settings.set_auth_token(buzz::AUTH_MECHANISM_GOOGLE_TOKEN,
88 xmpp_server_config_.auth_token); 88 xmpp_server_config_.auth_token);
89 89
90 int port = xmpp_server_config_.port; 90 int port = xmpp_server_config_.port;
91 91
92 // Port 5222 may be blocked by firewall. talk.google.com allows connections on 92 // Port 5222 may be blocked by firewall. talk.google.com allows connections on
93 // port 443 which can be used instead of 5222. The webapp still requests to 93 // port 443 which can be used instead of 5222. The webapp still requests to
94 // use port 5222 for backwards compatibility with older versions of the host 94 // use port 5222 for backwards compatibility with older versions of the host
95 // that do not pass correct |use_fake_ssl_client_socket| value to 95 // that do not pass correct |use_fake_ssl_client_socket| value to
96 // XmppClientSocketFactory (and so cannot connect to port 443). In case we are 96 // XmppClientSocketFactory (and so cannot connect to port 443). In case we are
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 ObserverListBase<Listener>::Iterator it(listeners_); 196 ObserverListBase<Listener>::Iterator it(listeners_);
197 Listener* listener; 197 Listener* listener;
198 while ((listener = it.GetNext()) != nullptr) { 198 while ((listener = it.GetNext()) != nullptr) {
199 if (listener->OnSignalStrategyIncomingStanza(stanza)) 199 if (listener->OnSignalStrategyIncomingStanza(stanza))
200 return true; 200 return true;
201 } 201 }
202 return false; 202 return false;
203 } 203 }
204 204
205 void XmppSignalStrategy::SetAuthInfo(const std::string& username, 205 void XmppSignalStrategy::SetAuthInfo(const std::string& username,
206 const std::string& auth_token, 206 const std::string& auth_token) {
207 const std::string& auth_service) {
208 DCHECK(CalledOnValidThread()); 207 DCHECK(CalledOnValidThread());
209 xmpp_server_config_.username = username; 208 xmpp_server_config_.username = username;
210 xmpp_server_config_.auth_token = auth_token; 209 xmpp_server_config_.auth_token = auth_token;
211 xmpp_server_config_.auth_service = auth_service;
212 } 210 }
213 211
214 void XmppSignalStrategy::SetResourceName(const std::string &resource_name) { 212 void XmppSignalStrategy::SetResourceName(const std::string &resource_name) {
215 DCHECK(CalledOnValidThread()); 213 DCHECK(CalledOnValidThread());
216 resource_name_ = resource_name; 214 resource_name_ = resource_name;
217 } 215 }
218 216
219 void XmppSignalStrategy::OnConnectionStateChanged( 217 void XmppSignalStrategy::OnConnectionStateChanged(
220 buzz::XmppEngine::State state) { 218 buzz::XmppEngine::State state) {
221 DCHECK(CalledOnValidThread()); 219 DCHECK(CalledOnValidThread());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 260 }
263 261
264 void XmppSignalStrategy::SendKeepAlive() { 262 void XmppSignalStrategy::SendKeepAlive() {
265 xmpp_client_->SendRaw(" "); 263 xmpp_client_->SendRaw(" ");
266 } 264 }
267 265
268 // static 266 // static
269 buzz::PreXmppAuth* XmppSignalStrategy::CreatePreXmppAuth( 267 buzz::PreXmppAuth* XmppSignalStrategy::CreatePreXmppAuth(
270 const buzz::XmppClientSettings& settings) { 268 const buzz::XmppClientSettings& settings) {
271 buzz::Jid jid(settings.user(), settings.host(), buzz::STR_EMPTY); 269 buzz::Jid jid(settings.user(), settings.host(), buzz::STR_EMPTY);
272 std::string mechanism = notifier::kDefaultGaiaAuthMechanism;
273 if (settings.token_service() == "oauth2") {
274 mechanism = "X-OAUTH2";
275 }
276
277 return new notifier::GaiaTokenPreXmppAuth( 270 return new notifier::GaiaTokenPreXmppAuth(
278 jid.Str(), settings.auth_token(), settings.token_service(), mechanism); 271 jid.Str(), settings.auth_token(), settings.token_service(), "X-OAUTH2");
279 } 272 }
280 273
281 } // namespace remoting 274 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/signaling/xmpp_signal_strategy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698