Index: remoting/host/host_plugin.cc |
diff --git a/remoting/host/host_plugin.cc b/remoting/host/host_plugin.cc |
index ac36cfa0bbadc5be508077a9428277334871d0c2..4236087e57a971e63fea10ce77f8af1b87d9c5dd 100644 |
--- a/remoting/host/host_plugin.cc |
+++ b/remoting/host/host_plugin.cc |
@@ -325,7 +325,9 @@ class HostNPScriptObject { |
void OnStateChanged(State state); |
// Currently just mock methods to verify that everything is working |
Jamie
2011/05/20 20:18:02
Presumably this comment is no longer accurate?
Wez
2011/05/20 20:52:10
Done.
|
- void OnReceivedSupportID(bool success, const std::string& support_id); |
+ void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, |
+ bool success, |
+ const std::string& support_id); |
void OnConnected(); |
void OnHostShutdown(); |
@@ -407,23 +409,27 @@ bool HostNPScriptObject::Connect(const NPVariant* args, |
host_key_pair.Generate(); |
host_key_pair.Save(host_config); |
- // Create the Host. |
- scoped_refptr<remoting::ChromotingHost> host = |
- remoting::ChromotingHost::Create(&host_context_, host_config, |
- access_verifier.release()); |
- |
// Request registration of the host for support. |
scoped_refptr<remoting::RegisterSupportHostRequest> register_request = |
new remoting::RegisterSupportHostRequest(); |
if (!register_request->Init( |
host_config.get(), |
base::Bind(&HostNPScriptObject::OnReceivedSupportID, |
- base::Unretained(this)))) { |
+ base::Unretained(this), |
+ access_verifier.get()))) { |
SetException("connect: RegisterSupportHostRequest::Init failed"); |
return false; |
} |
+ |
+ // Create the Host. |
+ scoped_refptr<remoting::ChromotingHost> host = |
+ remoting::ChromotingHost::Create(&host_context_, host_config, |
+ access_verifier.release()); |
host->AddStatusObserver(register_request); |
+ // TODO(wez): Improve our authentication framework. |
+ host->set_preauthenticated(true); |
+ |
// Nothing went wrong, so lets save the host, config and request. |
host_ = host; |
host_config_ = host_config; |
@@ -459,8 +465,10 @@ bool HostNPScriptObject::Disconnect(const NPVariant* args, |
return true; |
} |
-void HostNPScriptObject::OnReceivedSupportID(bool success, |
- const std::string& support_id) { |
+void HostNPScriptObject::OnReceivedSupportID( |
+ remoting::SupportAccessVerifier* access_verifier, |
+ bool success, |
+ const std::string& support_id) { |
CHECK_NE(base::PlatformThread::CurrentId(), np_thread_id_); |
if (!success) { |
@@ -469,10 +477,13 @@ void HostNPScriptObject::OnReceivedSupportID(bool success, |
return; |
} |
- // Combine the Support Id with the Host Id to make the Access Code |
+ // Inform the AccessVerifier of our Support-Id, for authentication. |
+ access_verifier->OnMe2MomHostRegistered(success, support_id); |
+ |
+ // Combine the Support Id with the Host Id to make the Access Code. |
// TODO(wez): Locking, anyone? |
access_code_ = support_id + "-" + host_secret_; |
- host_secret_ = std::string(); |
+ host_secret_.clear(); |
// Let the caller know that life is good. |
OnStateChanged(kReceivedAccessCode); |