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

Unified Diff: remoting/webapp/client_plugin_async.js

Issue 12905012: Webapp changes to support third party authentication (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase, update patch Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | remoting/webapp/client_screen.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_plugin_async.js
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js
index 71ec21f6dc6523074902d68a6bd8a5cc7043093e..788b49afb83a589f2901275876f5f2711867796f 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -40,6 +40,13 @@ remoting.ClientPluginAsync = function(plugin) {
this.onConnectionStatusUpdateHandler = function(state, error) {};
/** @param {boolean} ready Connection ready state. */
this.onConnectionReadyHandler = function(ready) {};
+ /**
+ * @param {string} tokenUrl Token-request URL, received from the host.
+ * @param {string} hostPublicKey Public key for the host.
+ * @param {string} scope OAuth scope to request the token for.
+ */
+ this.fetchThirdPartyTokenHandler = function(
+ tokenUrl, hostPublicKey, scope) {};
this.onDesktopSizeUpdateHandler = function () {};
/** @param {!Array.<string>} capabilities The negotiated capabilities. */
this.onSetCapabilitiesHandler = function (capabilities) {};
@@ -266,6 +273,18 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) {
/** @type {!Array.<string>} */
var capabilities = tokenize(message.data['capabilities']);
this.onSetCapabilitiesHandler(capabilities);
+ } else if (message.method == 'fetchThirdPartyToken') {
+ if (typeof message.data['tokenUrl'] != 'string' ||
+ typeof message.data['hostPublicKey'] != 'string' ||
+ typeof message.data['scope'] != 'string') {
+ console.error('Received incorrect fetchThirdPartyToken message.');
+ return;
+ }
+ var tokenUrl = /** @type {string} */ message.data['tokenUrl'];
+ var hostPublicKey =
+ /** @type {string} */ message.data['hostPublicKey'];
+ var scope = /** @type {string} */ message.data['scope'];
+ this.fetchThirdPartyTokenHandler(tokenUrl, hostPublicKey, scope);
}
};
@@ -523,6 +542,19 @@ remoting.ClientPluginAsync.prototype.useAsyncPinDialog =
};
/**
+ * Sets the third party authentication token and shared secret.
+ *
+ * @param {string} token The token received from the token URL.
+ * @param {string} sharedSecret Shared secret received from the token URL.
+ */
+remoting.ClientPluginAsync.prototype.onThirdPartyTokenFetched = function(
+ token, sharedSecret) {
+ this.plugin.postMessage(JSON.stringify(
+ { method: 'onThirdPartyTokenFetched',
+ data: { token: token, sharedSecret: sharedSecret}}));
+};
+
+/**
* If we haven't yet received a "hello" message from the plugin, change its
* size so that the user can confirm it if click-to-play is enabled, or can
* see the "this plugin is disabled" message if it is actually disabled.
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | remoting/webapp/client_screen.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698