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

Unified Diff: remoting/host/chromoting_host.cc

Issue 8619011: Use Authenticator interface in Session and SessionManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittests Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index b5365c6372aab2caa93816b3a0f84dd6f143e0e8..9e3d514f4977a1b7d4dca99a48eb115d3693afe9 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -18,7 +18,6 @@
#include "remoting/host/desktop_environment.h"
#include "remoting/host/event_executor.h"
#include "remoting/host/host_config.h"
-#include "remoting/host/host_key_pair.h"
#include "remoting/host/screen_recorder.h"
#include "remoting/jingle_glue/xmpp_signal_strategy.h"
#include "remoting/protocol/connection_to_client.h"
@@ -27,6 +26,7 @@
#include "remoting/protocol/input_stub.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/protocol/session_config.h"
+#include "remoting/protocol/v1_authenticator.h"
using remoting::protocol::ConnectionToClient;
using remoting::protocol::InputStub;
@@ -77,6 +77,12 @@ void ChromotingHost::Start() {
return;
state_ = kStarted;
+ // Assign key and certificate to server.
+ if (!key_pair_.Load(config_)) {
+ LOG(ERROR) << "Failed to load key pair for the host.";
+ return;
+ }
+
// Use an XMPP connection to the Talk network for session signalling.
std::string xmpp_login;
std::string xmpp_auth_token;
@@ -155,6 +161,14 @@ void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) {
status_observers_.push_back(observer);
}
+void ChromotingHost::SetSharedSecret(const std::string& shared_secret) {
+ DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
+ session_manager_->set_authenticator_factory(
+ new protocol::V1HostAuthenticatorFactory(
+ key_pair_.GenerateCertificate(), key_pair_.CopyPrivateKey(),
+ shared_secret));
+}
+
////////////////////////////////////////////////////////////////////////////
// protocol::ClientSession::EventHandler implementation.
void ChromotingHost::OnSessionAuthenticated(ClientSession* client) {
@@ -260,14 +274,8 @@ void ChromotingHost::OnStateChange(
protocol::JingleSessionManager* server =
new protocol::JingleSessionManager(context_->network_message_loop());
- // Assign key and certificate to server.
- HostKeyPair key_pair;
- CHECK(key_pair.Load(config_))
- << "Failed to load server authentication data";
-
- server->Init(local_jid_, signal_strategy_.get(), this,
- key_pair.CopyPrivateKey(), key_pair.GenerateCertificate(),
- allow_nat_traversal_);
+ server->Init(local_jid_, signal_strategy_.get(),
+ this, allow_nat_traversal_);
session_manager_.reset(server);
@@ -330,8 +338,6 @@ void ChromotingHost::OnIncomingSession(
}
session->set_config(config);
- // Provide the Access Code as shared secret for SSL channel authentication.
- session->set_shared_secret(access_code_);
*response = protocol::SessionManager::ACCEPT;
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698