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

Unified Diff: remoting/webapp/client_session.js

Issue 12905012: Webapp changes to support third party authentication (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
Index: remoting/webapp/client_session.js
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index bbc428a8374a3fd30c33d86465a93f28716bba00..d3d7f8562cc0cb9d19da371fe099006331a79dbc 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -362,7 +362,8 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(initialized) {
this.onConnectionReady_.bind(this);
this.plugin.onDesktopSizeUpdateHandler =
this.onDesktopSizeChanged_.bind(this);
-
+ this.plugin.fetchThirdPartyTokenHandler =
+ this.fetchThirdPartyToken_.bind(this);
this.connectPluginToWcs_();
};
@@ -698,7 +699,30 @@ remoting.ClientSession.prototype.onConnectionReady_ = function(ready) {
} else {
this.plugin.element().classList.remove("session-client-inactive");
}
-}
+};
+
+/**
+ * Callback that the plugin invokes when a token is required by a host.
+ *
+ * @private
+ * @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.
+ */
+remoting.ClientSession.prototype.fetchThirdPartyToken_ = function(
+ tokenUrl, hostPublicKey, scope) {
+ /** @type {remoting.ClientSession} */
+ var that = this;
Jamie 2013/03/28 23:29:36 I think this would be clearer using bind: this.pl
rmsousa 2013/03/29 04:08:21 Done.
+ var onThirdPartyTokenFetched =
+ /** @param {string} token
+ * @param {string} sharedSecret */
+ function(token, sharedSecret) {
+ that.plugin.onThirdPartyTokenFetched(token, sharedSecret);
+ };
+ var thirdPartyTokenFetcher = new remoting.ThirdPartyTokenFetcher(
+ tokenUrl, hostPublicKey, scope, onThirdPartyTokenFetched);
+ thirdPartyTokenFetcher.fetchToken();
+};
/**
* @private

Powered by Google App Engine
This is Rietveld 408576698