| OLD | NEW |
| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 this.authFlow = AuthFlow.DEFAULT; | 178 this.authFlow = AuthFlow.DEFAULT; |
| 179 this.samlHandler_.reset(); | 179 this.samlHandler_.reset(); |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 /** | 182 /** |
| 183 * Loads the authenticator component with the given parameters. | 183 * Loads the authenticator component with the given parameters. |
| 184 * @param {AuthMode} authMode Authorization mode. | 184 * @param {AuthMode} authMode Authorization mode. |
| 185 * @param {Object} data Parameters for the authorization flow. | 185 * @param {Object} data Parameters for the authorization flow. |
| 186 */ | 186 */ |
| 187 Authenticator.prototype.load = function(authMode, data) { | 187 Authenticator.prototype.load = function(authMode, data) { |
| 188 this.authMode = authMode; |
| 188 this.clearCredentials_(); | 189 this.clearCredentials_(); |
| 189 this.loaded_ = false; | 190 this.loaded_ = false; |
| 190 this.idpOrigin_ = data.gaiaUrl || IDP_ORIGIN; | 191 this.idpOrigin_ = data.gaiaUrl || IDP_ORIGIN; |
| 191 this.continueUrl_ = data.continueUrl || CONTINUE_URL; | 192 this.continueUrl_ = data.continueUrl || CONTINUE_URL; |
| 192 this.continueUrlWithoutParams_ = | 193 this.continueUrlWithoutParams_ = |
| 193 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) || | 194 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) || |
| 194 this.continueUrl_; | 195 this.continueUrl_; |
| 195 this.isConstrainedWindow_ = data.constrained == '1'; | 196 this.isConstrainedWindow_ = data.constrained == '1'; |
| 196 this.isNewGaiaFlowChromeOS = data.isNewGaiaFlowChromeOS; | 197 this.isNewGaiaFlowChromeOS = data.isNewGaiaFlowChromeOS; |
| 197 this.useEafe_ = data.useEafe || false; | 198 this.useEafe_ = data.useEafe || false; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 else | 316 else |
| 316 history.replaceState({url: url}, ''); | 317 history.replaceState({url: url}, ''); |
| 317 }; | 318 }; |
| 318 | 319 |
| 319 /** | 320 /** |
| 320 * Invoked when the sign-in page takes focus. | 321 * Invoked when the sign-in page takes focus. |
| 321 * @param {object} e The focus event being triggered. | 322 * @param {object} e The focus event being triggered. |
| 322 * @private | 323 * @private |
| 323 */ | 324 */ |
| 324 Authenticator.prototype.onFocus_ = function(e) { | 325 Authenticator.prototype.onFocus_ = function(e) { |
| 325 this.webview_.focus(); | 326 if (this.authMode == AuthMode.DESKTOP) |
| 327 this.webview_.focus(); |
| 326 }; | 328 }; |
| 327 | 329 |
| 328 /** | 330 /** |
| 329 * Invoked when the history state is changed. | 331 * Invoked when the history state is changed. |
| 330 * @param {object} e The popstate event being triggered. | 332 * @param {object} e The popstate event being triggered. |
| 331 * @private | 333 * @private |
| 332 */ | 334 */ |
| 333 Authenticator.prototype.onPopState_ = function(e) { | 335 Authenticator.prototype.onPopState_ = function(e) { |
| 334 var state = e.state; | 336 var state = e.state; |
| 335 if (state && state.url) | 337 if (state && state.url) |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 Authenticator.AuthMode = AuthMode; | 687 Authenticator.AuthMode = AuthMode; |
| 686 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; | 688 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; |
| 687 | 689 |
| 688 return { | 690 return { |
| 689 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old | 691 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old |
| 690 // iframe-based flow is deprecated. | 692 // iframe-based flow is deprecated. |
| 691 GaiaAuthHost: Authenticator, | 693 GaiaAuthHost: Authenticator, |
| 692 Authenticator: Authenticator | 694 Authenticator: Authenticator |
| 693 }; | 695 }; |
| 694 }); | 696 }); |
| OLD | NEW |