summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 15:05:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:33:47 +0000
commite684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch)
treed55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
parent2b94bfe47ccb6c08047959d1c26e392919550e86 (diff)
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/gaia_auth_host/authenticator.js')
-rw-r--r--chromium/chrome/browser/resources/gaia_auth_host/authenticator.js108
1 files changed, 9 insertions, 99 deletions
diff --git a/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js b/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
index d67eaeb3558..c790f1fb6b8 100644
--- a/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
+++ b/chromium/chrome/browser/resources/gaia_auth_host/authenticator.js
@@ -28,10 +28,6 @@ cr.define('cr.login', function() {
var SIGN_IN_HEADER = 'google-accounts-signin';
var EMBEDDED_FORM_HEADER = 'google-accounts-embedded';
var LOCATION_HEADER = 'location';
- var COOKIE_HEADER = 'cookie';
- var SET_COOKIE_HEADER = 'set-cookie';
- var OAUTH_CODE_COOKIE = 'oauth_code';
- var GAPS_COOKIE = 'GAPS';
var SERVICE_ID = 'chromeoslogin';
var EMBEDDED_SETUP_CHROMEOS_ENDPOINT = 'embedded/setup/chromeos';
var EMBEDDED_SETUP_CHROMEOS_ENDPOINT_V2 = 'embedded/setup/v2/chromeos';
@@ -88,7 +84,6 @@ cr.define('cr.login', function() {
'platformVersion', // Version of the OS build.
'releaseChannel', // Installation channel.
'endpointGen', // Current endpoint generation.
- 'gapsCookie', // GAPS cookie
'chromeOSApiVersion', // GAIA Chrome OS API version
'menuGuestMode', // Enables "Guest mode" menu item
'menuKeyboardOptions', // Enables "Keyboard options" menu item
@@ -140,10 +135,6 @@ cr.define('cr.login', function() {
this.initialFrameUrl_ = null;
this.reloadUrl_ = null;
this.trusted_ = true;
- this.oauthCode_ = null;
- this.gapsCookie_ = null;
- this.gapsCookieSent_ = false;
- this.newGapsCookie_ = null;
this.readyFired_ = false;
this.webviewEventManager_ = WebviewEventManager.create();
@@ -191,10 +182,6 @@ cr.define('cr.login', function() {
this.email_ = null;
this.gaiaId_ = null;
this.password_ = null;
- this.oauthCode_ = null;
- this.gapsCookie_ = null;
- this.gapsCookieSent_ = false;
- this.newGapsCookie_ = null;
this.readyFired_ = false;
this.chooseWhatToSync_ = false;
this.skipForNow_ = false;
@@ -300,9 +287,6 @@ cr.define('cr.login', function() {
this.isConstrainedWindow_ = data.constrained == '1';
this.isNewGaiaFlow = data.isNewGaiaFlow;
this.clientId_ = data.clientId;
- this.gapsCookie_ = data.gapsCookie;
- this.gapsCookieSent_ = false;
- this.newGapsCookie_ = null;
this.dontResizeNonEmbeddedPages = data.dontResizeNonEmbeddedPages;
this.chromeOSApiVersion_ = data.chromeOSApiVersion;
@@ -318,16 +302,6 @@ cr.define('cr.login', function() {
this.webview_.contextMenus.onShow.addListener(function(e) {
e.preventDefault();
});
-
- if (!this.onBeforeSetHeadersSet_) {
- this.onBeforeSetHeadersSet_ = true;
- var filterPrefix = this.constructChromeOSAPIUrl_();
- // This depends on gaiaUrl parameter, that is why it is here.
- this.webview_.request.onBeforeSendHeaders.addListener(
- this.onBeforeSendHeaders_.bind(this),
- {urls: [filterPrefix + '?*', filterPrefix + '/*']},
- ['requestHeaders', 'blocking']);
- }
}
this.webview_.src = this.reloadUrl_;
@@ -424,8 +398,12 @@ cr.define('cr.login', function() {
url = appendParam(url, 'source', CONSTRAINED_FLOW_SOURCE);
if (data.flow)
url = appendParam(url, 'flow', data.flow);
- if (data.emailDomain)
+ if (data.emailDomain) {
url = appendParam(url, 'emaildomain', data.emailDomain);
+ // ChromeOS embedded signin page uses 'hd' (hosted domain) as the query
+ // argument to show an email domain.
+ url = appendParam(url, 'hd', data.emailDomain);
+ }
return url;
};
@@ -554,74 +532,8 @@ cr.define('cr.login', function() {
// URL will contain a source=3 field.
var location = decodeURIComponent(header.value);
this.chooseWhatToSync_ = !!location.match(/(\?|&)source=3($|&)/);
- } else if (this.isNewGaiaFlow && headerName == SET_COOKIE_HEADER) {
- var headerValue = header.value;
- if (headerValue.startsWith(OAUTH_CODE_COOKIE + '=')) {
- this.oauthCode_ =
- headerValue.substring(OAUTH_CODE_COOKIE.length + 1).split(';')[0];
- }
- if (headerValue.startsWith(GAPS_COOKIE + '=')) {
- this.newGapsCookie_ =
- headerValue.substring(GAPS_COOKIE.length + 1).split(';')[0];
- }
- }
- }
- };
-
- /**
- * This method replaces cookie value in cookie header.
- * @param@ {string} header_value Original string value of Cookie header.
- * @param@ {string} cookie_name Name of cookie to be replaced.
- * @param@ {string} cookie_value New cookie value.
- * @return {string} New Cookie header value.
- * @private
- */
- Authenticator.prototype.updateCookieValue_ = function(
- header_value, cookie_name, cookie_value) {
- var cookies = header_value.split(/\s*;\s*/);
- var found = false;
- for (var i = 0; i < cookies.length; ++i) {
- if (cookies[i].startsWith(cookie_name + '=')) {
- found = true;
- cookies[i] = cookie_name + '=' + cookie_value;
- break;
- }
- }
- if (!found) {
- cookies.push(cookie_name + '=' + cookie_value);
- }
- return cookies.join('; ');
- };
-
- /**
- * Handler for webView.request.onBeforeSendHeaders .
- * @return {!Object} Modified request headers.
- * @private
- */
- Authenticator.prototype.onBeforeSendHeaders_ = function(details) {
- // We should re-send cookie if first request was unsuccessful (i.e. no new
- // GAPS cookie was received).
- if (this.isNewGaiaFlow && this.gapsCookie_ &&
- (!this.gapsCookieSent_ || !this.newGapsCookie_)) {
- var headers = details.requestHeaders;
- var found = false;
- var gapsCookie = this.gapsCookie_;
-
- for (var i = 0, l = headers.length; i < l; ++i) {
- if (headers[i].name == COOKIE_HEADER) {
- headers[i].value = this.updateCookieValue_(
- headers[i].value, GAPS_COOKIE, gapsCookie);
- found = true;
- break;
- }
- }
- if (!found) {
- details.requestHeaders.push(
- {name: COOKIE_HEADER, value: GAPS_COOKIE + '=' + gapsCookie});
}
- this.gapsCookieSent_ = true;
}
- return {requestHeaders: details.requestHeaders};
};
/**
@@ -860,13 +772,11 @@ cr.define('cr.login', function() {
email: this.email_ || '',
gaiaId: this.gaiaId_ || '',
password: this.password_ || '',
- authCode: this.oauthCode_,
usingSAML: this.authFlow == AuthFlow.SAML,
chooseWhatToSync: this.chooseWhatToSync_,
skipForNow: this.skipForNow_,
sessionIndex: this.sessionIndex_ || '',
trusted: this.trusted_,
- gapsCookie: this.newGapsCookie_ || this.gapsCookie_ || '',
services: this.services_ || [],
}
}));
@@ -919,9 +829,9 @@ cr.define('cr.login', function() {
*/
Authenticator.prototype.onSamlApiPasswordAdded_ = function(e) {
// Saml API 'add' password might be received after the 'loadcommit' event.
- // In such case, maybeCompleteAuth_ should be attempted again if oauth code
- // is available.
- if (this.oauthCode_)
+ // In such case, maybeCompleteAuth_ should be attempted again if GAIA ID is
+ // available.
+ if (this.gaiaId_)
this.maybeCompleteAuth_();
};
@@ -997,7 +907,7 @@ cr.define('cr.login', function() {
* @private
*/
Authenticator.prototype.onLoadCommit_ = function(e) {
- if (this.oauthCode_)
+ if (this.gaiaId_)
this.maybeCompleteAuth_();
};