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

Side by Side Diff: chrome/browser/resources/gaia_auth_host/authenticator.js

Issue 1988113004: Clear the login webview when SAML flow is canceled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reset SAML webview with 'about:blank'. Reset when network is disconnected. Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 <include src="saml_handler.js"> 5 <include src="saml_handler.js">
6 6
7 /** 7 /**
8 * @fileoverview An UI component to authenciate to Chrome. The component hosts 8 * @fileoverview An UI component to authenciate to Chrome. The component hosts
9 * IdP web pages in a webview. A client who is interested in monitoring 9 * IdP web pages in a webview. A client who is interested in monitoring
10 * authentication events should pass a listener object of type 10 * authentication events should pass a listener object of type
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 window.addEventListener( 189 window.addEventListener(
190 'popstate', this.onPopState_.bind(this), false); 190 'popstate', this.onPopState_.bind(this), false);
191 } 191 }
192 192
193 Authenticator.prototype = Object.create(cr.EventTarget.prototype); 193 Authenticator.prototype = Object.create(cr.EventTarget.prototype);
194 194
195 /** 195 /**
196 * Reinitializes authentication parameters so that a failed login attempt 196 * Reinitializes authentication parameters so that a failed login attempt
197 * would not result in an infinite loop. 197 * would not result in an infinite loop.
198 */ 198 */
199 Authenticator.prototype.resetStates_ = function() { 199 Authenticator.prototype.resetStates = function() {
emaxx 2016/05/23 15:00:49 Removed trailing underscore, as this method is cal
200 this.isLoaded_ = false; 200 this.isLoaded_ = false;
201 this.email_ = null; 201 this.email_ = null;
202 this.gaiaId_ = null; 202 this.gaiaId_ = null;
203 this.password_ = null; 203 this.password_ = null;
204 this.oauthCode_ = null; 204 this.oauthCode_ = null;
205 this.gapsCookie_ = null; 205 this.gapsCookie_ = null;
206 this.gapsCookieSent_ = false; 206 this.gapsCookieSent_ = false;
207 this.newGapsCookie_ = null; 207 this.newGapsCookie_ = null;
208 this.readyFired_ = false; 208 this.readyFired_ = false;
209 this.chooseWhatToSync_ = false; 209 this.chooseWhatToSync_ = false;
210 this.skipForNow_ = false; 210 this.skipForNow_ = false;
211 this.sessionIndex_ = null; 211 this.sessionIndex_ = null;
212 this.trusted_ = true; 212 this.trusted_ = true;
213 this.authFlow = AuthFlow.DEFAULT; 213 this.authFlow = AuthFlow.DEFAULT;
214 this.samlHandler_.reset(); 214 this.samlHandler_.reset();
215 this.videoEnabled = false; 215 this.videoEnabled = false;
216 this.webview_.src = 'about:blank';
achuithb 2016/05/24 23:29:27 Is it worthwhile adding a short comment here about
216 }; 217 };
217 218
218 /** 219 /**
219 * Loads the authenticator component with the given parameters. 220 * Loads the authenticator component with the given parameters.
220 * @param {AuthMode} authMode Authorization mode. 221 * @param {AuthMode} authMode Authorization mode.
221 * @param {Object} data Parameters for the authorization flow. 222 * @param {Object} data Parameters for the authorization flow.
222 */ 223 */
223 Authenticator.prototype.load = function(authMode, data) { 224 Authenticator.prototype.load = function(authMode, data) {
224 this.authMode = authMode; 225 this.authMode = authMode;
225 this.resetStates_(); 226 this.resetStates();
226 // gaiaUrl parameter is used for testing. Once defined, it is never changed. 227 // gaiaUrl parameter is used for testing. Once defined, it is never changed.
227 this.idpOrigin_ = data.gaiaUrl || IDP_ORIGIN; 228 this.idpOrigin_ = data.gaiaUrl || IDP_ORIGIN;
228 this.continueUrl_ = data.continueUrl || CONTINUE_URL; 229 this.continueUrl_ = data.continueUrl || CONTINUE_URL;
229 this.continueUrlWithoutParams_ = 230 this.continueUrlWithoutParams_ =
230 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) || 231 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) ||
231 this.continueUrl_; 232 this.continueUrl_;
232 this.isConstrainedWindow_ = data.constrained == '1'; 233 this.isConstrainedWindow_ = data.constrained == '1';
233 this.isNewGaiaFlow = data.isNewGaiaFlow; 234 this.isNewGaiaFlow = data.isNewGaiaFlow;
234 this.useEafe_ = data.useEafe || false; 235 this.useEafe_ = data.useEafe || false;
235 this.clientId_ = data.clientId; 236 this.clientId_ = data.clientId;
(...skipping 27 matching lines...) Expand all
263 } 264 }
264 265
265 this.webview_.src = this.reloadUrl_; 266 this.webview_.src = this.reloadUrl_;
266 this.isLoaded_ = true; 267 this.isLoaded_ = true;
267 }; 268 };
268 269
269 /** 270 /**
270 * Reloads the authenticator component. 271 * Reloads the authenticator component.
271 */ 272 */
272 Authenticator.prototype.reload = function() { 273 Authenticator.prototype.reload = function() {
273 this.resetStates_(); 274 this.resetStates();
274 this.webview_.src = this.reloadUrl_; 275 this.webview_.src = this.reloadUrl_;
275 this.isLoaded_ = true; 276 this.isLoaded_ = true;
276 }; 277 };
277 278
278 Authenticator.prototype.constructInitialFrameUrl_ = function(data) { 279 Authenticator.prototype.constructInitialFrameUrl_ = function(data) {
279 if (data.doSamlRedirect) { 280 if (data.doSamlRedirect) {
280 var url = this.idpOrigin_ + SAML_REDIRECTION_PATH; 281 var url = this.idpOrigin_ + SAML_REDIRECTION_PATH;
281 url = appendParam(url, 'domain', data.enterpriseDomain); 282 url = appendParam(url, 'domain', data.enterpriseDomain);
282 url = appendParam(url, 'continue', data.gaiaUrl + 283 url = appendParam(url, 'continue', data.gaiaUrl +
283 'o/oauth2/programmatic_auth?hl=' + data.hl + 284 'o/oauth2/programmatic_auth?hl=' + data.hl +
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 password: this.password_ || '', 697 password: this.password_ || '',
697 authCode: this.oauthCode_, 698 authCode: this.oauthCode_,
698 usingSAML: this.authFlow == AuthFlow.SAML, 699 usingSAML: this.authFlow == AuthFlow.SAML,
699 chooseWhatToSync: this.chooseWhatToSync_, 700 chooseWhatToSync: this.chooseWhatToSync_,
700 skipForNow: this.skipForNow_, 701 skipForNow: this.skipForNow_,
701 sessionIndex: this.sessionIndex_ || '', 702 sessionIndex: this.sessionIndex_ || '',
702 trusted: this.trusted_, 703 trusted: this.trusted_,
703 gapsCookie: this.newGapsCookie_ || this.gapsCookie_ || '', 704 gapsCookie: this.newGapsCookie_ || this.gapsCookie_ || '',
704 } 705 }
705 })); 706 }));
706 this.resetStates_(); 707 this.resetStates();
707 }; 708 };
708 709
709 /** 710 /**
710 * Invoked when |samlHandler_| fires 'insecureContentBlocked' event. 711 * Invoked when |samlHandler_| fires 'insecureContentBlocked' event.
711 * @private 712 * @private
712 */ 713 */
713 Authenticator.prototype.onInsecureContentBlocked_ = function(e) { 714 Authenticator.prototype.onInsecureContentBlocked_ = function(e) {
714 if (!this.isLoaded_) 715 if (!this.isLoaded_)
715 return; 716 return;
716 717
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 Authenticator.AuthMode = AuthMode; 864 Authenticator.AuthMode = AuthMode;
864 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; 865 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS;
865 866
866 return { 867 return {
867 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old 868 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old
868 // iframe-based flow is deprecated. 869 // iframe-based flow is deprecated.
869 GaiaAuthHost: Authenticator, 870 GaiaAuthHost: Authenticator,
870 Authenticator: Authenticator 871 Authenticator: Authenticator
871 }; 872 };
872 }); 873 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698