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

Side by Side Diff: remoting/host/simple_host_process.cc

Issue 9270031: Enable V2 authentication for Me2Me host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This is an application of a minimal host process in a Chromoting 5 // This is an application of a minimal host process in a Chromoting
6 // system. It serves the purpose of gluing different pieces together 6 // system. It serves the purpose of gluing different pieces together
7 // to make a functional host process for testing. 7 // to make a functional host process for testing.
8 // 8 //
9 // It peforms the following functionality: 9 // It peforms the following functionality:
10 // 1. Connect to the GTalk network and register the machine as a host. 10 // 1. Connect to the GTalk network and register the machine as a host.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 if (!config->GetString(kHostIdConfigPath, &host_id_)) { 115 if (!config->GetString(kHostIdConfigPath, &host_id_)) {
116 LOG(ERROR) << "host_id is not defined in the config."; 116 LOG(ERROR) << "host_id is not defined in the config.";
117 return 1; 117 return 1;
118 } 118 }
119 119
120 if (!key_pair_.Load(config)) { 120 if (!key_pair_.Load(config)) {
121 return 1; 121 return 1;
122 } 122 }
123 123
124 std::string host_secret_hash_string;
125 if (!config->GetString(kHostSecretHashConfigPath,
126 &host_secret_hash_string)) {
127 host_secret_hash_string = "plain:";
128 }
129
130 if (!host_secret_hash_.Parse(host_secret_hash_string)) {
131 LOG(ERROR) << "Invalid host_secret_hash.";
132 return false;
133 }
134
124 // Use an XMPP connection to the Talk network for session signalling. 135 // Use an XMPP connection to the Talk network for session signalling.
125 if (!config->GetString(kXmppLoginConfigPath, &xmpp_login_) || 136 if (!config->GetString(kXmppLoginConfigPath, &xmpp_login_) ||
126 !config->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token_)) { 137 !config->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token_)) {
127 LOG(ERROR) << "XMPP credentials are not defined in the config."; 138 LOG(ERROR) << "XMPP credentials are not defined in the config.";
128 return 1; 139 return 1;
129 } 140 }
130 if (!config->GetString(kXmppAuthServiceConfigPath, &xmpp_auth_service_)) { 141 if (!config->GetString(kXmppAuthServiceConfigPath, &xmpp_auth_service_)) {
131 // For the simple host, we assume we always use the ClientLogin token for 142 // For the simple host, we assume we always use the ClientLogin token for
132 // chromiumsync because we do not have an HTTP stack with which we can 143 // chromiumsync because we do not have an HTTP stack with which we can
133 // easily request an OAuth2 access token even if we had a RefreshToken for 144 // easily request an OAuth2 access token even if we had a RefreshToken for
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 signal_strategy_.get(), &key_pair_, 246 signal_strategy_.get(), &key_pair_,
236 base::Bind(&SimpleHost::SetIT2MeAccessCode, host_, &key_pair_))); 247 base::Bind(&SimpleHost::SetIT2MeAccessCode, host_, &key_pair_)));
237 } else { 248 } else {
238 heartbeat_sender_.reset( 249 heartbeat_sender_.reset(
239 new HeartbeatSender(host_id_, signal_strategy_.get(), &key_pair_)); 250 new HeartbeatSender(host_id_, signal_strategy_.get(), &key_pair_));
240 } 251 }
241 252
242 host_->Start(); 253 host_->Start();
243 254
244 // Create a Me2Me authenticator factory. 255 // Create a Me2Me authenticator factory.
245 //
246 // TODO(sergeyu): Currently empty PIN is used. This is a temporary
247 // hack pending us adding a way to set a PIN. crbug.com/105214 .
248 if (!is_it2me_) { 256 if (!is_it2me_) {
249 scoped_ptr<protocol::AuthenticatorFactory> factory( 257 scoped_ptr<protocol::AuthenticatorFactory> factory(
250 new protocol::Me2MeHostAuthenticatorFactory( 258 new protocol::Me2MeHostAuthenticatorFactory(
251 xmpp_login_, key_pair_.GenerateCertificate(), 259 xmpp_login_, key_pair_.GenerateCertificate(),
252 *key_pair_.private_key(), "")); 260 *key_pair_.private_key(), host_secret_hash_));
253 host_->SetAuthenticatorFactory(factory.Pass()); 261 host_->SetAuthenticatorFactory(factory.Pass());
254 } 262 }
255 } 263 }
256 264
257 MessageLoop message_loop_; 265 MessageLoop message_loop_;
258 base::Thread file_io_thread_; 266 base::Thread file_io_thread_;
259 ChromotingHostContext context_; 267 ChromotingHostContext context_;
260 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; 268 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
261 269
262 FilePath config_path_; 270 FilePath config_path_;
263 bool fake_; 271 bool fake_;
264 bool is_it2me_; 272 bool is_it2me_;
265 NetworkSettings network_settings_; 273 NetworkSettings network_settings_;
266 scoped_ptr<CandidateSessionConfig> protocol_config_; 274 scoped_ptr<CandidateSessionConfig> protocol_config_;
267 275
268 std::string host_id_; 276 std::string host_id_;
269 HostKeyPair key_pair_; 277 HostKeyPair key_pair_;
278 protocol::SharedSecretHash host_secret_hash_;
270 std::string xmpp_login_; 279 std::string xmpp_login_;
271 std::string xmpp_auth_token_; 280 std::string xmpp_auth_token_;
272 std::string xmpp_auth_service_; 281 std::string xmpp_auth_service_;
273 282
274 scoped_ptr<SignalStrategy> signal_strategy_; 283 scoped_ptr<SignalStrategy> signal_strategy_;
275 scoped_ptr<SignalingConnector> signaling_connector_; 284 scoped_ptr<SignalingConnector> signaling_connector_;
276 scoped_ptr<DesktopEnvironment> desktop_environment_; 285 scoped_ptr<DesktopEnvironment> desktop_environment_;
277 scoped_ptr<LogToServer> log_to_server_; 286 scoped_ptr<LogToServer> log_to_server_;
278 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; 287 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_;
279 scoped_ptr<RegisterSupportHostRequest> register_request_; 288 scoped_ptr<RegisterSupportHostRequest> register_request_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 max_port < 0 || max_port > 65535) { 368 max_port < 0 || max_port > 65535) {
360 LOG(ERROR) << "Invalid max-port value: " << max_port 369 LOG(ERROR) << "Invalid max-port value: " << max_port
361 << ". Expected integer in range [0, 65535]."; 370 << ". Expected integer in range [0, 65535].";
362 return 1; 371 return 1;
363 } 372 }
364 simple_host.network_settings()->max_port = max_port; 373 simple_host.network_settings()->max_port = max_port;
365 } 374 }
366 375
367 return simple_host.Run(); 376 return simple_host.Run();
368 } 377 }
OLDNEW
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/protocol/me2me_host_authenticator_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698