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

Unified Diff: remoting/webapp/remoting.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/plugin_settings.js ('k') | remoting/webapp/session_connector.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/remoting.js
diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js
index 616732af760ae8dcdb705ecbf8f996e97594d88b..0989777bce319f6b04724dc4fb5262f1e1a1b95b 100644
--- a/remoting/webapp/remoting.js
+++ b/remoting/webapp/remoting.js
@@ -382,3 +382,14 @@ function migrateLocalToChromeStorage_() {
}
}
}
+
+/**
+ * Generate a nonce, to be used as an xsrf protection token.
+ *
+ * @return {string} A URL-Safe Base64-encoded 128-bit random value. */
+remoting.generateXsrfToken = function() {
+ var random = new Uint8Array(16);
+ window.crypto.getRandomValues(random);
+ var base64Token = window.btoa(String.fromCharCode.apply(null, random));
+ return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
+};
« no previous file with comments | « remoting/webapp/plugin_settings.js ('k') | remoting/webapp/session_connector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698