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

Unified Diff: chrome/browser/resources/gaia_auth_host/authenticator.js

Issue 1012083002: Resolve new GAIA flow's infinite loop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 5 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: chrome/browser/resources/gaia_auth_host/authenticator.js
diff --git a/chrome/browser/resources/gaia_auth_host/authenticator.js b/chrome/browser/resources/gaia_auth_host/authenticator.js
index e2dc8b69d3b1f5ff64cea31a317d3d5f3eb9ff6e..dc0fea89559871b3d2800b3749e84060badb7727 100644
--- a/chrome/browser/resources/gaia_auth_host/authenticator.js
+++ b/chrome/browser/resources/gaia_auth_host/authenticator.js
@@ -145,11 +145,30 @@ cr.define('cr.login', function() {
Authenticator.prototype = Object.create(cr.EventTarget.prototype);
/**
+ * Reinitializes authentication parameters so that a failed login attempt
+ * would not result in an infinite loop.
+ */
+ Authenticator.prototype.clearCredentials_ = function() {
+ this.email_ = null;
+ this.gaiaId_ = null;
+ this.password_ = null;
+ this.oauth_code_ = null;
+ this.chooseWhatToSync_ = false;
+ this.skipForNow_ = false;
+ this.sessionIndex_ = null;
+ this.trusted_ = true;
+ this.authFlow = AuthFlow.DEFAULT;
+ this.samlHandler_.reset();
+ this.loaded_ = false;
+ };
+
+ /**
* Loads the authenticator component with the given parameters.
* @param {AuthMode} authMode Authorization mode.
* @param {Object} data Parameters for the authorization flow.
*/
Authenticator.prototype.load = function(authMode, data) {
+ this.clearCredentials_();
this.idpOrigin_ = data.gaiaUrl || IDP_ORIGIN;
this.continueUrl_ = data.continueUrl || CONTINUE_URL;
this.continueUrlWithoutParams_ =
@@ -160,26 +179,20 @@ cr.define('cr.login', function() {
this.initialFrameUrl_ = this.constructInitialFrameUrl_(data);
this.reloadUrl_ = data.frameUrl || this.initialFrameUrl_;
- this.authFlow = AuthFlow.DEFAULT;
- this.samlHandler_.reset();
// Don't block insecure content for desktop flow because it lands on
// http. Otherwise, block insecure content as long as gaia is https.
this.samlHandler_.blockInsecureContent = authMode != AuthMode.DESKTOP &&
this.idpOrigin_.indexOf('https://') == 0;
this.webview_.src = this.reloadUrl_;
-
- this.loaded_ = false;
};
/**
* Reloads the authenticator component.
*/
Authenticator.prototype.reload = function() {
+ this.clearCredentials_();
this.webview_.src = this.reloadUrl_;
- this.authFlow = AuthFlow.DEFAULT;
- this.samlHandler_.reset();
- this.loaded_ = false;
};
Authenticator.prototype.constructInitialFrameUrl_ = function(data) {

Powered by Google App Engine
This is Rietveld 408576698