| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 this.isLoaded_ = false; | 124 this.isLoaded_ = false; |
| 125 this.email_ = null; | 125 this.email_ = null; |
| 126 this.password_ = null; | 126 this.password_ = null; |
| 127 this.gaiaId_ = null, | 127 this.gaiaId_ = null, |
| 128 this.sessionIndex_ = null; | 128 this.sessionIndex_ = null; |
| 129 this.chooseWhatToSync_ = false; | 129 this.chooseWhatToSync_ = false; |
| 130 this.skipForNow_ = false; | 130 this.skipForNow_ = false; |
| 131 this.authFlow = AuthFlow.DEFAULT; | 131 this.authFlow = AuthFlow.DEFAULT; |
| 132 this.authDomain = ''; | 132 this.authDomain = ''; |
| 133 this.videoEnabled = false; |
| 133 this.idpOrigin_ = null; | 134 this.idpOrigin_ = null; |
| 134 this.continueUrl_ = null; | 135 this.continueUrl_ = null; |
| 135 this.continueUrlWithoutParams_ = null; | 136 this.continueUrlWithoutParams_ = null; |
| 136 this.initialFrameUrl_ = null; | 137 this.initialFrameUrl_ = null; |
| 137 this.reloadUrl_ = null; | 138 this.reloadUrl_ = null; |
| 138 this.trusted_ = true; | 139 this.trusted_ = true; |
| 139 this.oauthCode_ = null; | 140 this.oauthCode_ = null; |
| 140 this.gapsCookie_ = null; | 141 this.gapsCookie_ = null; |
| 141 this.gapsCookieSent_ = false; | 142 this.gapsCookieSent_ = false; |
| 142 this.newGapsCookie_ = null; | 143 this.newGapsCookie_ = null; |
| 143 this.readyFired_ = false; | 144 this.readyFired_ = false; |
| 144 | 145 |
| 145 this.useEafe_ = false; | 146 this.useEafe_ = false; |
| 146 this.clientId_ = null; | 147 this.clientId_ = null; |
| 147 | 148 |
| 148 this.samlHandler_ = new cr.login.SamlHandler(this.webview_); | 149 this.samlHandler_ = new cr.login.SamlHandler(this.webview_); |
| 149 this.confirmPasswordCallback = null; | 150 this.confirmPasswordCallback = null; |
| 150 this.noPasswordCallback = null; | 151 this.noPasswordCallback = null; |
| 151 this.insecureContentBlockedCallback = null; | 152 this.insecureContentBlockedCallback = null; |
| 152 this.samlApiUsedCallback = null; | 153 this.samlApiUsedCallback = null; |
| 153 this.missingGaiaInfoCallback = null; | 154 this.missingGaiaInfoCallback = null; |
| 154 this.needPassword = true; | 155 this.needPassword = true; |
| 155 this.samlHandler_.addEventListener( | 156 this.samlHandler_.addEventListener( |
| 156 'insecureContentBlocked', | 157 'insecureContentBlocked', |
| 157 this.onInsecureContentBlocked_.bind(this)); | 158 this.onInsecureContentBlocked_.bind(this)); |
| 158 this.samlHandler_.addEventListener( | 159 this.samlHandler_.addEventListener( |
| 159 'authPageLoaded', | 160 'authPageLoaded', |
| 160 this.onAuthPageLoaded_.bind(this)); | 161 this.onAuthPageLoaded_.bind(this)); |
| 162 this.samlHandler_.addEventListener( |
| 163 'videoEnabled', |
| 164 this.onVideoEnabled_.bind(this)); |
| 161 | 165 |
| 162 this.webview_.addEventListener('droplink', this.onDropLink_.bind(this)); | 166 this.webview_.addEventListener('droplink', this.onDropLink_.bind(this)); |
| 163 this.webview_.addEventListener( | 167 this.webview_.addEventListener( |
| 164 'newwindow', this.onNewWindow_.bind(this)); | 168 'newwindow', this.onNewWindow_.bind(this)); |
| 165 this.webview_.addEventListener( | 169 this.webview_.addEventListener( |
| 166 'contentload', this.onContentLoad_.bind(this)); | 170 'contentload', this.onContentLoad_.bind(this)); |
| 167 this.webview_.addEventListener( | 171 this.webview_.addEventListener( |
| 168 'loadabort', this.onLoadAbort_.bind(this)); | 172 'loadabort', this.onLoadAbort_.bind(this)); |
| 169 this.webview_.addEventListener( | 173 this.webview_.addEventListener( |
| 170 'loadstop', this.onLoadStop_.bind(this)); | 174 'loadstop', this.onLoadStop_.bind(this)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 201 this.gapsCookie_ = null; | 205 this.gapsCookie_ = null; |
| 202 this.gapsCookieSent_ = false; | 206 this.gapsCookieSent_ = false; |
| 203 this.newGapsCookie_ = null; | 207 this.newGapsCookie_ = null; |
| 204 this.readyFired_ = false; | 208 this.readyFired_ = false; |
| 205 this.chooseWhatToSync_ = false; | 209 this.chooseWhatToSync_ = false; |
| 206 this.skipForNow_ = false; | 210 this.skipForNow_ = false; |
| 207 this.sessionIndex_ = null; | 211 this.sessionIndex_ = null; |
| 208 this.trusted_ = true; | 212 this.trusted_ = true; |
| 209 this.authFlow = AuthFlow.DEFAULT; | 213 this.authFlow = AuthFlow.DEFAULT; |
| 210 this.samlHandler_.reset(); | 214 this.samlHandler_.reset(); |
| 215 this.videoEnabled = false; |
| 211 }; | 216 }; |
| 212 | 217 |
| 213 /** | 218 /** |
| 214 * Loads the authenticator component with the given parameters. | 219 * Loads the authenticator component with the given parameters. |
| 215 * @param {AuthMode} authMode Authorization mode. | 220 * @param {AuthMode} authMode Authorization mode. |
| 216 * @param {Object} data Parameters for the authorization flow. | 221 * @param {Object} data Parameters for the authorization flow. |
| 217 */ | 222 */ |
| 218 Authenticator.prototype.load = function(authMode, data) { | 223 Authenticator.prototype.load = function(authMode, data) { |
| 219 this.authMode = authMode; | 224 this.authMode = authMode; |
| 220 this.resetStates_(); | 225 this.resetStates_(); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 if (!e.detail.isSAMLPage) | 731 if (!e.detail.isSAMLPage) |
| 727 return; | 732 return; |
| 728 | 733 |
| 729 this.authDomain = this.samlHandler_.authDomain; | 734 this.authDomain = this.samlHandler_.authDomain; |
| 730 this.authFlow = AuthFlow.SAML; | 735 this.authFlow = AuthFlow.SAML; |
| 731 | 736 |
| 732 this.fireReadyEvent_(); | 737 this.fireReadyEvent_(); |
| 733 }; | 738 }; |
| 734 | 739 |
| 735 /** | 740 /** |
| 741 * Invoked when |samlHandler_| fires 'videoEnabled' event. |
| 742 * @private |
| 743 */ |
| 744 Authenticator.prototype.onVideoEnabled_ = function(e) { |
| 745 this.videoEnabled = true; |
| 746 }; |
| 747 |
| 748 /** |
| 736 * Invoked when a link is dropped on the webview. | 749 * Invoked when a link is dropped on the webview. |
| 737 * @private | 750 * @private |
| 738 */ | 751 */ |
| 739 Authenticator.prototype.onDropLink_ = function(e) { | 752 Authenticator.prototype.onDropLink_ = function(e) { |
| 740 this.dispatchEvent(new CustomEvent('dropLink', {detail: e.url})); | 753 this.dispatchEvent(new CustomEvent('dropLink', {detail: e.url})); |
| 741 }; | 754 }; |
| 742 | 755 |
| 743 /** | 756 /** |
| 744 * Invoked when the webview attempts to open a new window. | 757 * Invoked when the webview attempts to open a new window. |
| 745 * @private | 758 * @private |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 * @type {AuthFlow} | 846 * @type {AuthFlow} |
| 834 */ | 847 */ |
| 835 cr.defineProperty(Authenticator, 'authFlow'); | 848 cr.defineProperty(Authenticator, 'authFlow'); |
| 836 | 849 |
| 837 /** | 850 /** |
| 838 * The domain name of the current auth page. | 851 * The domain name of the current auth page. |
| 839 * @type {string} | 852 * @type {string} |
| 840 */ | 853 */ |
| 841 cr.defineProperty(Authenticator, 'authDomain'); | 854 cr.defineProperty(Authenticator, 'authDomain'); |
| 842 | 855 |
| 856 /** |
| 857 * True if the page has requested media access. |
| 858 * @type {boolean} |
| 859 */ |
| 860 cr.defineProperty(Authenticator, 'videoEnabled'); |
| 861 |
| 843 Authenticator.AuthFlow = AuthFlow; | 862 Authenticator.AuthFlow = AuthFlow; |
| 844 Authenticator.AuthMode = AuthMode; | 863 Authenticator.AuthMode = AuthMode; |
| 845 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; | 864 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; |
| 846 | 865 |
| 847 return { | 866 return { |
| 848 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old | 867 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old |
| 849 // iframe-based flow is deprecated. | 868 // iframe-based flow is deprecated. |
| 850 GaiaAuthHost: Authenticator, | 869 GaiaAuthHost: Authenticator, |
| 851 Authenticator: Authenticator | 870 Authenticator: Authenticator |
| 852 }; | 871 }; |
| 853 }); | 872 }); |
| OLD | NEW |