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/chromeos/login/screen_gaia_signin.js

Issue 1983433002: Add timeout for SAML webcam logins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@saml-ui
Patch Set: cancel timeout on auth completed 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * @fileoverview Oobe signin screen implementation. 6 * @fileoverview Oobe signin screen implementation.
7 */ 7 */
8 8
9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
10 // GAIA animation guard timer. Started when GAIA page is loaded 10 // GAIA animation guard timer. Started when GAIA page is loaded
11 // (Authenticator 'ready' event) and is intended to guard against edge cases 11 // (Authenticator 'ready' event) and is intended to guard against edge cases
12 // when 'showView' message is not generated/received. 12 // when 'showView' message is not generated/received.
13 /** @const */ var GAIA_ANIMATION_GUARD_MILLISEC = 300; 13 /** @const */ var GAIA_ANIMATION_GUARD_MILLISEC = 300;
14 14
15 // Maximum Gaia loading time in seconds. 15 // Maximum Gaia loading time in seconds.
16 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; 16 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60;
17 17
18 // The help topic regarding user not being in the whitelist. 18 // The help topic regarding user not being in the whitelist.
19 /** @const */ var HELP_CANT_ACCESS_ACCOUNT = 188036; 19 /** @const */ var HELP_CANT_ACCESS_ACCOUNT = 188036;
20 20
21 // Amount of time the user has to be idle for before showing the online login 21 // Amount of time the user has to be idle for before showing the online login
22 // page. 22 // page.
23 /** @const */ var IDLE_TIME_UNTIL_EXIT_OFFLINE_IN_MILLISECONDS = 180 * 1000; 23 /** @const */ var IDLE_TIME_UNTIL_EXIT_OFFLINE_IN_MILLISECONDS = 180 * 1000;
24 24
25 // Approximate amount of time between checks to see if we should go to the 25 // Approximate amount of time between checks to see if we should go to the
26 // online login page when we're in the offline login page and the device is 26 // online login page when we're in the offline login page and the device is
27 // online. 27 // online.
28 /** @const */ var IDLE_TIME_CHECK_FREQUENCY = 5 * 1000; 28 /** @const */ var IDLE_TIME_CHECK_FREQUENCY = 5 * 1000;
29 29
30 // Amount of time allowed for video based SAML logins, to prevent a site
31 // from keeping the camera on indefinitely. This is a hard deadline and
32 // it will not be extended by user activity.
33 /** @const */ var VIDEO_LOGIN_TIMEOUT = 60 * 1000;
emaxx 2016/05/18 01:14:53 According to http://crbug.com/606979#c8, the timeo
Kevin Cernekee 2016/05/18 20:38:09 Done.
34
30 /** 35 /**
31 * The modes this screen can be in. 36 * The modes this screen can be in.
32 * @enum {integer} 37 * @enum {integer}
33 */ 38 */
34 var ScreenMode = { 39 var ScreenMode = {
35 DEFAULT: 0, // Default GAIA login flow. 40 DEFAULT: 0, // Default GAIA login flow.
36 OFFLINE: 1, // GAIA offline login. 41 OFFLINE: 1, // GAIA offline login.
37 SAML_INTERSTITIAL: 2 // Interstitial page before SAML redirection. 42 SAML_INTERSTITIAL: 2 // Interstitial page before SAML redirection.
38 }; 43 };
39 44
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 80
76 /** 81 /**
77 * Timer id of a guard timer that is fired in case 'showView' message 82 * Timer id of a guard timer that is fired in case 'showView' message
78 * is not received from GAIA. 83 * is not received from GAIA.
79 * @type {number} 84 * @type {number}
80 * @private 85 * @private
81 */ 86 */
82 loadAnimationGuardTimer_: undefined, 87 loadAnimationGuardTimer_: undefined,
83 88
84 /** 89 /**
90 * Timer id of the video login timer.
91 * @type {number}
92 * @private
93 */
94 videoTimer_: undefined,
95
96 /**
85 * Whether we've processed 'showView' message - either from GAIA or from 97 * Whether we've processed 'showView' message - either from GAIA or from
86 * guard timer. 98 * guard timer.
87 * @type {boolean} 99 * @type {boolean}
88 * @private 100 * @private
89 */ 101 */
90 showViewProcessed_: false, 102 showViewProcessed_: false,
91 103
92 /** 104 /**
93 * Whether we've processed 'authCompleted' message. 105 * Whether we've processed 'authCompleted' message.
94 * @type {boolean} 106 * @type {boolean}
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 */ 640 */
629 onAuthDomainChange_: function() { 641 onAuthDomainChange_: function() {
630 this.updateSamlNotice_(); 642 this.updateSamlNotice_();
631 }, 643 },
632 644
633 /** 645 /**
634 * Invoked when the videoEnabled property is changed on the GAIA host. 646 * Invoked when the videoEnabled property is changed on the GAIA host.
635 */ 647 */
636 onVideoEnabledChange_: function() { 648 onVideoEnabledChange_: function() {
637 this.updateSamlNotice_(); 649 this.updateSamlNotice_();
650 if (this.gaiaAuthHost_.videoEnabled && this.videoTimer_ === undefined) {
651 this.videoTimer_ = setTimeout(this.cancel.bind(this),
652 VIDEO_LOGIN_TIMEOUT);
653 }
emaxx 2016/05/18 01:14:53 I guess that, as an effect of the Authenticator.re
Kevin Cernekee 2016/05/18 20:38:09 Done.
638 }, 654 },
639 655
640 /** 656 /**
641 * Invoked when the authFlow property is changed on the GAIA host. 657 * Invoked when the authFlow property is changed on the GAIA host.
642 */ 658 */
643 onAuthFlowChange_: function() { 659 onAuthFlowChange_: function() {
644 var isSAML = this.isSAML(); 660 var isSAML = this.isSAML();
645 661
646 this.classList.toggle('full-width', isSAML); 662 this.classList.toggle('full-width', isSAML);
647 $('saml-notice-container').hidden = !isSAML; 663 $('saml-notice-container').hidden = !isSAML;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 credentials.usingSAML]); 864 credentials.usingSAML]);
849 } 865 }
850 866
851 this.loading = true; 867 this.loading = true;
852 868
853 // Now that we're in logged in state header should be hidden. 869 // Now that we're in logged in state header should be hidden.
854 Oobe.getInstance().headerHidden = true; 870 Oobe.getInstance().headerHidden = true;
855 // Clear any error messages that were shown before login. 871 // Clear any error messages that were shown before login.
856 Oobe.clearErrors(); 872 Oobe.clearErrors();
857 873
874 if (this.videoTimer_ !== undefined) {
achuithb 2016/05/17 23:38:38 Maybe add a method like clearVideoTimer()?
Kevin Cernekee 2016/05/18 20:38:09 Done.
875 clearTimeout(this.videoTimer_);
876 this.videoTimer_ = undefined;
877 }
878
858 this.authCompleted_ = true; 879 this.authCompleted_ = true;
859 this.updateControlsState(); 880 this.updateControlsState();
860 }, 881 },
861 882
862 /** 883 /**
863 * Invoked when onAuthCompleted message received. 884 * Invoked when onAuthCompleted message received.
864 * @param {!Object} e Payload of the received HTML5 message. 885 * @param {!Object} e Payload of the received HTML5 message.
865 * @private 886 * @private
866 */ 887 */
867 onAuthCompletedMessage_: function(e) { 888 onAuthCompletedMessage_: function(e) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 } 965 }
945 }, 966 },
946 967
947 /** 968 /**
948 * Called when user canceled signin. 969 * Called when user canceled signin.
949 */ 970 */
950 cancel: function() { 971 cancel: function() {
951 if (!this.navigation_.refreshVisible && !this.navigation_.closeVisible) 972 if (!this.navigation_.refreshVisible && !this.navigation_.closeVisible)
952 return; 973 return;
953 974
975 if (this.videoTimer_ !== undefined) {
emaxx 2016/05/18 01:30:17 Shouldn't this be moved to the top of the function
Kevin Cernekee 2016/05/18 20:38:09 Done.
976 clearTimeout(this.videoTimer_);
977 this.videoTimer_ = undefined;
978 }
979
954 if (this.closable) 980 if (this.closable)
955 Oobe.showUserPods(); 981 Oobe.showUserPods();
956 else 982 else
957 Oobe.resetSigninUI(true); 983 Oobe.resetSigninUI(true);
958 }, 984 },
959 985
960 /** 986 /**
961 * Handler for webview error handling. 987 * Handler for webview error handling.
962 * @param {!Object} data Additional information about error event like: 988 * @param {!Object} data Additional information about error event like:
963 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED". 989 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED".
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 this.classList.toggle('whitelist-error', show); 1036 this.classList.toggle('whitelist-error', show);
1011 this.loading = !show; 1037 this.loading = !show;
1012 1038
1013 if (!show) 1039 if (!show)
1014 Oobe.showSigninUI(); 1040 Oobe.showSigninUI();
1015 1041
1016 this.updateControlsState(); 1042 this.updateControlsState();
1017 } 1043 }
1018 }; 1044 };
1019 }); 1045 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698