| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/host/it2me/it2me_host.h" | 5 #include "remoting/host/it2me/it2me_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "remoting/base/service_urls.h" | 22 #include "remoting/base/service_urls.h" |
| 23 #include "remoting/host/chromoting_host.h" | 23 #include "remoting/host/chromoting_host.h" |
| 24 #include "remoting/host/chromoting_host_context.h" | 24 #include "remoting/host/chromoting_host_context.h" |
| 25 #include "remoting/host/host_event_logger.h" | 25 #include "remoting/host/host_event_logger.h" |
| 26 #include "remoting/host/host_secret.h" | 26 #include "remoting/host/host_secret.h" |
| 27 #include "remoting/host/host_status_logger.h" | 27 #include "remoting/host/host_status_logger.h" |
| 28 #include "remoting/host/it2me/it2me_confirmation_dialog.h" | 28 #include "remoting/host/it2me/it2me_confirmation_dialog.h" |
| 29 #include "remoting/host/it2me_desktop_environment.h" | 29 #include "remoting/host/it2me_desktop_environment.h" |
| 30 #include "remoting/host/policy_watcher.h" | 30 #include "remoting/host/policy_watcher.h" |
| 31 #include "remoting/host/register_support_host_request.h" | 31 #include "remoting/host/register_support_host_request.h" |
| 32 #include "remoting/protocol/auth_util.h" |
| 32 #include "remoting/protocol/chromium_port_allocator_factory.h" | 33 #include "remoting/protocol/chromium_port_allocator_factory.h" |
| 33 #include "remoting/protocol/ice_transport.h" | 34 #include "remoting/protocol/ice_transport.h" |
| 34 #include "remoting/protocol/it2me_host_authenticator_factory.h" | 35 #include "remoting/protocol/it2me_host_authenticator_factory.h" |
| 35 #include "remoting/protocol/jingle_session_manager.h" | 36 #include "remoting/protocol/jingle_session_manager.h" |
| 36 #include "remoting/protocol/network_settings.h" | 37 #include "remoting/protocol/network_settings.h" |
| 37 #include "remoting/protocol/transport_context.h" | 38 #include "remoting/protocol/transport_context.h" |
| 38 #include "remoting/signaling/server_log_entry.h" | 39 #include "remoting/signaling/server_log_entry.h" |
| 39 | 40 |
| 40 namespace remoting { | 41 namespace remoting { |
| 41 | 42 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); | 461 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); |
| 461 | 462 |
| 462 if (!error_message.empty()) { | 463 if (!error_message.empty()) { |
| 463 SetState(kError, error_message); | 464 SetState(kError, error_message); |
| 464 Shutdown(); | 465 Shutdown(); |
| 465 return; | 466 return; |
| 466 } | 467 } |
| 467 | 468 |
| 468 std::string host_secret = GenerateSupportHostSecret(); | 469 std::string host_secret = GenerateSupportHostSecret(); |
| 469 std::string access_code = support_id + host_secret; | 470 std::string access_code = support_id + host_secret; |
| 471 std::string access_code_hash = |
| 472 protocol::GetSharedSecretHash(support_id, access_code); |
| 470 | 473 |
| 471 std::string local_certificate = host_key_pair_->GenerateCertificate(); | 474 std::string local_certificate = host_key_pair_->GenerateCertificate(); |
| 472 if (local_certificate.empty()) { | 475 if (local_certificate.empty()) { |
| 473 std::string error_message = "Failed to generate host certificate."; | 476 std::string error_message = "Failed to generate host certificate."; |
| 474 LOG(ERROR) << error_message; | 477 LOG(ERROR) << error_message; |
| 475 SetState(kError, error_message); | 478 SetState(kError, error_message); |
| 476 Shutdown(); | 479 Shutdown(); |
| 477 return; | 480 return; |
| 478 } | 481 } |
| 479 | 482 |
| 480 scoped_ptr<protocol::AuthenticatorFactory> factory( | 483 scoped_ptr<protocol::AuthenticatorFactory> factory( |
| 481 new protocol::It2MeHostAuthenticatorFactory( | 484 new protocol::It2MeHostAuthenticatorFactory( |
| 482 local_certificate, host_key_pair_, access_code, | 485 local_certificate, host_key_pair_, access_code_hash, |
| 483 required_client_domain_)); | 486 required_client_domain_)); |
| 484 host_->SetAuthenticatorFactory(std::move(factory)); | 487 host_->SetAuthenticatorFactory(std::move(factory)); |
| 485 | 488 |
| 486 // Pass the Access Code to the script object before changing state. | 489 // Pass the Access Code to the script object before changing state. |
| 487 task_runner_->PostTask( | 490 task_runner_->PostTask( |
| 488 FROM_HERE, base::Bind(&It2MeHost::Observer::OnStoreAccessCode, | 491 FROM_HERE, base::Bind(&It2MeHost::Observer::OnStoreAccessCode, |
| 489 observer_, access_code, lifetime)); | 492 observer_, access_code, lifetime)); |
| 490 | 493 |
| 491 SetState(kReceivedAccessCode, ""); | 494 SetState(kReceivedAccessCode, ""); |
| 492 } | 495 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 513 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( | 516 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory( |
| 514 new It2MeConfirmationDialogFactory()); | 517 new It2MeConfirmationDialogFactory()); |
| 515 scoped_ptr<PolicyWatcher> policy_watcher = | 518 scoped_ptr<PolicyWatcher> policy_watcher = |
| 516 PolicyWatcher::Create(policy_service_, context->file_task_runner()); | 519 PolicyWatcher::Create(policy_service_, context->file_task_runner()); |
| 517 return new It2MeHost(std::move(context), std::move(policy_watcher), | 520 return new It2MeHost(std::move(context), std::move(policy_watcher), |
| 518 std::move(confirmation_dialog_factory), observer, | 521 std::move(confirmation_dialog_factory), observer, |
| 519 xmpp_server_config, directory_bot_jid); | 522 xmpp_server_config, directory_bot_jid); |
| 520 } | 523 } |
| 521 | 524 |
| 522 } // namespace remoting | 525 } // namespace remoting |
| OLD | NEW |