Chromium Code Reviews| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 assert(this.webview_); | 122 assert(this.webview_); |
| 123 | 123 |
| 124 this.email_ = null; | 124 this.email_ = null; |
| 125 this.password_ = null; | 125 this.password_ = null; |
| 126 this.gaiaId_ = null, | 126 this.gaiaId_ = null, |
| 127 this.sessionIndex_ = null; | 127 this.sessionIndex_ = null; |
| 128 this.chooseWhatToSync_ = false; | 128 this.chooseWhatToSync_ = false; |
| 129 this.skipForNow_ = false; | 129 this.skipForNow_ = false; |
| 130 this.authFlow = AuthFlow.DEFAULT; | 130 this.authFlow = AuthFlow.DEFAULT; |
| 131 this.authDomain = ''; | 131 this.authDomain = ''; |
| 132 this.videoEnabled = false; | |
| 132 this.idpOrigin_ = null; | 133 this.idpOrigin_ = null; |
| 133 this.continueUrl_ = null; | 134 this.continueUrl_ = null; |
| 134 this.continueUrlWithoutParams_ = null; | 135 this.continueUrlWithoutParams_ = null; |
| 135 this.initialFrameUrl_ = null; | 136 this.initialFrameUrl_ = null; |
| 136 this.reloadUrl_ = null; | 137 this.reloadUrl_ = null; |
| 137 this.trusted_ = true; | 138 this.trusted_ = true; |
| 138 this.oauthCode_ = null; | 139 this.oauthCode_ = null; |
| 139 this.gapsCookie_ = null; | 140 this.gapsCookie_ = null; |
| 140 this.gapsCookieSent_ = false; | 141 this.gapsCookieSent_ = false; |
| 141 this.newGapsCookie_ = null; | 142 this.newGapsCookie_ = null; |
| 142 this.readyFired_ = false; | 143 this.readyFired_ = false; |
| 143 | 144 |
| 144 this.useEafe_ = false; | 145 this.useEafe_ = false; |
| 145 this.clientId_ = null; | 146 this.clientId_ = null; |
| 146 | 147 |
| 147 this.samlHandler_ = new cr.login.SamlHandler(this.webview_); | 148 this.samlHandler_ = new cr.login.SamlHandler(this.webview_); |
| 148 this.confirmPasswordCallback = null; | 149 this.confirmPasswordCallback = null; |
| 149 this.noPasswordCallback = null; | 150 this.noPasswordCallback = null; |
| 150 this.insecureContentBlockedCallback = null; | 151 this.insecureContentBlockedCallback = null; |
| 151 this.samlApiUsedCallback = null; | 152 this.samlApiUsedCallback = null; |
| 152 this.missingGaiaInfoCallback = null; | 153 this.missingGaiaInfoCallback = null; |
| 153 this.needPassword = true; | 154 this.needPassword = true; |
| 154 this.samlHandler_.addEventListener( | 155 this.samlHandler_.addEventListener( |
| 155 'insecureContentBlocked', | 156 'insecureContentBlocked', |
| 156 this.onInsecureContentBlocked_.bind(this)); | 157 this.onInsecureContentBlocked_.bind(this)); |
| 157 this.samlHandler_.addEventListener( | 158 this.samlHandler_.addEventListener( |
| 158 'authPageLoaded', | 159 'authPageLoaded', |
| 159 this.onAuthPageLoaded_.bind(this)); | 160 this.onAuthPageLoaded_.bind(this)); |
| 161 this.samlHandler_.addEventListener( | |
| 162 'videoEnabled', | |
| 163 this.onVideoEnabled_.bind(this)); | |
| 160 | 164 |
| 161 this.webview_.addEventListener('droplink', this.onDropLink_.bind(this)); | 165 this.webview_.addEventListener('droplink', this.onDropLink_.bind(this)); |
| 162 this.webview_.addEventListener( | 166 this.webview_.addEventListener( |
| 163 'newwindow', this.onNewWindow_.bind(this)); | 167 'newwindow', this.onNewWindow_.bind(this)); |
| 164 this.webview_.addEventListener( | 168 this.webview_.addEventListener( |
| 165 'contentload', this.onContentLoad_.bind(this)); | 169 'contentload', this.onContentLoad_.bind(this)); |
| 166 this.webview_.addEventListener( | 170 this.webview_.addEventListener( |
| 167 'loadabort', this.onLoadAbort_.bind(this)); | 171 'loadabort', this.onLoadAbort_.bind(this)); |
| 168 this.webview_.addEventListener( | 172 this.webview_.addEventListener( |
| 169 'loadstop', this.onLoadStop_.bind(this)); | 173 'loadstop', this.onLoadStop_.bind(this)); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 184 window.addEventListener( | 188 window.addEventListener( |
| 185 'popstate', this.onPopState_.bind(this), false); | 189 'popstate', this.onPopState_.bind(this), false); |
| 186 } | 190 } |
| 187 | 191 |
| 188 Authenticator.prototype = Object.create(cr.EventTarget.prototype); | 192 Authenticator.prototype = Object.create(cr.EventTarget.prototype); |
| 189 | 193 |
| 190 /** | 194 /** |
| 191 * Reinitializes authentication parameters so that a failed login attempt | 195 * Reinitializes authentication parameters so that a failed login attempt |
| 192 * would not result in an infinite loop. | 196 * would not result in an infinite loop. |
| 193 */ | 197 */ |
| 194 Authenticator.prototype.resetStates_ = function() { | 198 Authenticator.prototype.resetStates_ = function() { |
|
emaxx
2016/05/17 11:12:23
You mentioned in the other CL that manual cancelin
Kevin Cernekee
2016/05/17 21:31:05
Done.
| |
| 195 this.email_ = null; | 199 this.email_ = null; |
| 196 this.gaiaId_ = null; | 200 this.gaiaId_ = null; |
| 197 this.password_ = null; | 201 this.password_ = null; |
| 198 this.oauthCode_ = null; | 202 this.oauthCode_ = null; |
| 199 this.gapsCookie_ = null; | 203 this.gapsCookie_ = null; |
| 200 this.gapsCookieSent_ = false; | 204 this.gapsCookieSent_ = false; |
| 201 this.newGapsCookie_ = null; | 205 this.newGapsCookie_ = null; |
| 202 this.readyFired_ = false; | 206 this.readyFired_ = false; |
| 203 this.chooseWhatToSync_ = false; | 207 this.chooseWhatToSync_ = false; |
| 204 this.skipForNow_ = false; | 208 this.skipForNow_ = false; |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 717 if (!e.detail.isSAMLPage) | 721 if (!e.detail.isSAMLPage) |
| 718 return; | 722 return; |
| 719 | 723 |
| 720 this.authDomain = this.samlHandler_.authDomain; | 724 this.authDomain = this.samlHandler_.authDomain; |
| 721 this.authFlow = AuthFlow.SAML; | 725 this.authFlow = AuthFlow.SAML; |
| 722 | 726 |
| 723 this.fireReadyEvent_(); | 727 this.fireReadyEvent_(); |
| 724 }; | 728 }; |
| 725 | 729 |
| 726 /** | 730 /** |
| 731 * Invoked when |samlHandler_| fires 'videoEnabled' event. | |
| 732 * @private | |
| 733 */ | |
| 734 Authenticator.prototype.onVideoEnabled_ = function(e) { | |
| 735 this.videoEnabled = true; | |
| 736 }; | |
| 737 | |
| 738 /** | |
| 727 * Invoked when a link is dropped on the webview. | 739 * Invoked when a link is dropped on the webview. |
| 728 * @private | 740 * @private |
| 729 */ | 741 */ |
| 730 Authenticator.prototype.onDropLink_ = function(e) { | 742 Authenticator.prototype.onDropLink_ = function(e) { |
| 731 this.dispatchEvent(new CustomEvent('dropLink', {detail: e.url})); | 743 this.dispatchEvent(new CustomEvent('dropLink', {detail: e.url})); |
| 732 }; | 744 }; |
| 733 | 745 |
| 734 /** | 746 /** |
| 735 * Invoked when the webview attempts to open a new window. | 747 * Invoked when the webview attempts to open a new window. |
| 736 * @private | 748 * @private |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 824 * @type {AuthFlow} | 836 * @type {AuthFlow} |
| 825 */ | 837 */ |
| 826 cr.defineProperty(Authenticator, 'authFlow'); | 838 cr.defineProperty(Authenticator, 'authFlow'); |
| 827 | 839 |
| 828 /** | 840 /** |
| 829 * The domain name of the current auth page. | 841 * The domain name of the current auth page. |
| 830 * @type {string} | 842 * @type {string} |
| 831 */ | 843 */ |
| 832 cr.defineProperty(Authenticator, 'authDomain'); | 844 cr.defineProperty(Authenticator, 'authDomain'); |
| 833 | 845 |
| 846 /** | |
| 847 * True if the page has requested media access. | |
| 848 * @type {boolean} | |
| 849 */ | |
| 850 cr.defineProperty(Authenticator, 'videoEnabled'); | |
| 851 | |
| 834 Authenticator.AuthFlow = AuthFlow; | 852 Authenticator.AuthFlow = AuthFlow; |
| 835 Authenticator.AuthMode = AuthMode; | 853 Authenticator.AuthMode = AuthMode; |
| 836 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; | 854 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; |
| 837 | 855 |
| 838 return { | 856 return { |
| 839 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old | 857 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old |
| 840 // iframe-based flow is deprecated. | 858 // iframe-based flow is deprecated. |
| 841 GaiaAuthHost: Authenticator, | 859 GaiaAuthHost: Authenticator, |
| 842 Authenticator: Authenticator | 860 Authenticator: Authenticator |
| 843 }; | 861 }; |
| 844 }); | 862 }); |
| OLD | NEW |