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

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: incorporate code review feedback 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 = 180 * 1000;
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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } else { 629 } else {
618 $('saml-notice-message').textContent = loadTimeData.getStringF( 630 $('saml-notice-message').textContent = loadTimeData.getStringF(
619 'samlNotice', 631 'samlNotice',
620 this.gaiaAuthHost_.authDomain); 632 this.gaiaAuthHost_.authDomain);
621 $('saml-notice-recording-indicator').hidden = true; 633 $('saml-notice-recording-indicator').hidden = true;
622 $('saml-notice-container').style.justifyContent = 'center'; 634 $('saml-notice-container').style.justifyContent = 'center';
623 } 635 }
624 }, 636 },
625 637
626 /** 638 /**
627 * Invoked when the authDomain property is changed on the GAIA host. 639 * Invoked when the authDomain property is changed on the GAIA host.
achuithb 2016/05/18 21:08:25 Fix comment?
Kevin Cernekee 2016/05/18 21:15:50 Done.
628 */ 640 */
641 clearVideoTimer_: function() {
642 if (this.videoTimer_ !== undefined) {
643 clearTimeout(this.videoTimer_);
644 this.videoTimer_ = undefined;
645 }
646 },
647
648 /**
649 * Invoked when the authDomain property is changed on the GAIA host.
650 */
629 onAuthDomainChange_: function() { 651 onAuthDomainChange_: function() {
630 this.updateSamlNotice_(); 652 this.updateSamlNotice_();
631 }, 653 },
632 654
633 /** 655 /**
634 * Invoked when the videoEnabled property is changed on the GAIA host. 656 * Invoked when the videoEnabled property is changed on the GAIA host.
635 */ 657 */
636 onVideoEnabledChange_: function() { 658 onVideoEnabledChange_: function() {
637 this.updateSamlNotice_(); 659 this.updateSamlNotice_();
660 if (this.gaiaAuthHost_.videoEnabled && this.videoTimer_ === undefined) {
661 this.videoTimer_ = setTimeout(this.cancel.bind(this),
662 VIDEO_LOGIN_TIMEOUT);
663 } else {
664 this.clearVideoTimer_();
665 }
638 }, 666 },
639 667
640 /** 668 /**
641 * Invoked when the authFlow property is changed on the GAIA host. 669 * Invoked when the authFlow property is changed on the GAIA host.
642 */ 670 */
643 onAuthFlowChange_: function() { 671 onAuthFlowChange_: function() {
644 var isSAML = this.isSAML(); 672 var isSAML = this.isSAML();
645 673
646 this.classList.toggle('full-width', isSAML); 674 this.classList.toggle('full-width', isSAML);
647 $('saml-notice-container').hidden = !isSAML; 675 $('saml-notice-container').hidden = !isSAML;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 credentials.usingSAML]); 876 credentials.usingSAML]);
849 } 877 }
850 878
851 this.loading = true; 879 this.loading = true;
852 880
853 // Now that we're in logged in state header should be hidden. 881 // Now that we're in logged in state header should be hidden.
854 Oobe.getInstance().headerHidden = true; 882 Oobe.getInstance().headerHidden = true;
855 // Clear any error messages that were shown before login. 883 // Clear any error messages that were shown before login.
856 Oobe.clearErrors(); 884 Oobe.clearErrors();
857 885
886 this.clearVideoTimer_();
858 this.authCompleted_ = true; 887 this.authCompleted_ = true;
859 this.updateControlsState(); 888 this.updateControlsState();
860 }, 889 },
861 890
862 /** 891 /**
863 * Invoked when onAuthCompleted message received. 892 * Invoked when onAuthCompleted message received.
864 * @param {!Object} e Payload of the received HTML5 message. 893 * @param {!Object} e Payload of the received HTML5 message.
865 * @private 894 * @private
866 */ 895 */
867 onAuthCompletedMessage_: function(e) { 896 onAuthCompletedMessage_: function(e) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } else { 970 } else {
942 // Defer the bubble until the frame has been loaded. 971 // Defer the bubble until the frame has been loaded.
943 this.errorBubble_ = [loginAttempts, error]; 972 this.errorBubble_ = [loginAttempts, error];
944 } 973 }
945 }, 974 },
946 975
947 /** 976 /**
948 * Called when user canceled signin. 977 * Called when user canceled signin.
949 */ 978 */
950 cancel: function() { 979 cancel: function() {
980 this.clearVideoTimer_();
951 if (!this.navigation_.refreshVisible && !this.navigation_.closeVisible) 981 if (!this.navigation_.refreshVisible && !this.navigation_.closeVisible)
952 return; 982 return;
953 983
954 if (this.closable) 984 if (this.closable)
955 Oobe.showUserPods(); 985 Oobe.showUserPods();
956 else 986 else
957 Oobe.resetSigninUI(true); 987 Oobe.resetSigninUI(true);
958 }, 988 },
959 989
960 /** 990 /**
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 this.classList.toggle('whitelist-error', show); 1040 this.classList.toggle('whitelist-error', show);
1011 this.loading = !show; 1041 this.loading = !show;
1012 1042
1013 if (!show) 1043 if (!show)
1014 Oobe.showSigninUI(); 1044 Oobe.showSigninUI();
1015 1045
1016 this.updateControlsState(); 1046 this.updateControlsState();
1017 } 1047 }
1018 }; 1048 };
1019 }); 1049 });
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