Index: remoting/host/host_plugin.cc |
diff --git a/remoting/host/host_plugin.cc b/remoting/host/host_plugin.cc |
index 371d91f7e7e71786dfa0946e9508679a386a1435..a9bd51dcc4858f1b5ccadaf2bc69fa6a48ff8066 100644 |
--- a/remoting/host/host_plugin.cc |
+++ b/remoting/host/host_plugin.cc |
@@ -25,6 +25,7 @@ |
#include "base/mac/foundation_util.h" |
#endif |
#include "media/base/media.h" |
+#include "remoting/base/auth_token_util.h" |
#include "remoting/host/chromoting_host.h" |
#include "remoting/host/chromoting_host_context.h" |
#include "remoting/host/host_config.h" |
@@ -58,7 +59,9 @@ |
attribute Function void onStateChanged(); |
- void connect(string uid, string auth_token); |
+ // Auth token should be in the format "service:token". And example |
Wez
2011/05/25 03:57:46
Typo: And
awong
2011/05/25 16:56:56
Done.
Jamie
2011/05/25 17:04:52
Should we name the parameter explicitly in the com
awong
2011/05/25 18:00:02
Done.
|
+ // would be "oauth2:1/2a3912vd". |
+ void connect(string uid, string auth_token_with_service); |
Wez
2011/05/25 03:57:46
If these were called |auth_service_and_token| the
awong
2011/05/25 16:56:56
Done.
|
void disconnect(); |
*/ |
@@ -388,9 +391,17 @@ bool HostNPScriptObject::Connect(const NPVariant* args, |
return false; |
} |
- std::string auth_token = StringFromNPVariant(args[1]); |
+ std::string auth_token_with_service = StringFromNPVariant(args[1]); |
+ if (auth_token_with_service.empty()) { |
Wez
2011/05/25 03:57:46
Why do this test here; the empty token case post-p
awong
2011/05/25 16:56:56
cause I'm silly? :)
Fixed.
|
+ SetException("connect: bad auth_token_with_service argument"); |
+ return false; |
+ } |
+ std::string auth_token; |
+ std::string auth_service; |
+ remoting::ParseAuthTokenWithService(auth_token_with_service, &auth_token, |
+ &auth_service); |
if (auth_token.empty()) { |
Jamie
2011/05/25 17:04:52
Do we need a check for an empty service? The strin
awong
2011/05/25 18:00:02
I'm intentionally not doing that for now so I don'
|
- SetException("connect: bad auth_token argument"); |
+ SetException("connect: auth_token_with_service argument has empty token"); |
return false; |
} |
@@ -422,6 +433,7 @@ bool HostNPScriptObject::Connect(const NPVariant* args, |
new remoting::InMemoryHostConfig; |
host_config->SetString(remoting::kXmppLoginConfigPath, uid); |
host_config->SetString(remoting::kXmppAuthTokenConfigPath, auth_token); |
+ host_config->SetString(remoting::kXmppAuthServiceConfigPath, auth_service); |
// Create an access verifier and fetch the host secret. |
scoped_ptr<remoting::SupportAccessVerifier> access_verifier; |