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

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_gaia_signin.js

Issue 473153002: Inline sign in extracts gaia id from HTTP header and seeds account tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix one unit test, progress on second Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
bartfab (slow) 2014/10/17 09:54:55 You will need to modify oobe_screen_oauth_enrollme
Roger Tawa OOO till Jul 10th 2014/10/20 16:04:00 Done.
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 <include src="../../gaia_auth_host/gaia_auth_host.js"> 9 <include src="../../gaia_auth_host/gaia_auth_host.js">
10 10
11 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { 11 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
12 // Gaia loading time after which error message must be displayed and 12 // Gaia loading time after which error message must be displayed and
13 // lazy portal check should be fired. 13 // lazy portal check should be fired.
14 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; 14 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7;
15 15
16 // Maximum Gaia loading time in seconds. 16 // Maximum Gaia loading time in seconds.
17 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; 17 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60;
18 18
19 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; 19 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613;
20 20
21 return { 21 return {
22 EXTERNAL_API: [ 22 EXTERNAL_API: [
23 'loadAuthExtension', 23 'loadAuthExtension',
24 'updateAuthExtension', 24 'updateAuthExtension',
25 'setAuthenticatedUserEmail',
26 'doReload', 25 'doReload',
27 'onFrameError', 26 'onFrameError',
28 'updateCancelButtonState' 27 'updateCancelButtonState'
29 ], 28 ],
30 29
31 /** 30 /**
32 * Frame loading error code (0 - no error). 31 * Frame loading error code (0 - no error).
33 * @type {number} 32 * @type {number}
34 * @private 33 * @private
35 */ 34 */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 * SAML password confirmation attempt count. 86 * SAML password confirmation attempt count.
88 * @type {number} 87 * @type {number}
89 */ 88 */
90 samlPasswordConfirmAttempt_: 0, 89 samlPasswordConfirmAttempt_: 0,
91 90
92 /** @override */ 91 /** @override */
93 decorate: function() { 92 decorate: function() {
94 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); 93 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame'));
95 this.gaiaAuthHost_.addEventListener( 94 this.gaiaAuthHost_.addEventListener(
96 'ready', this.onAuthReady_.bind(this)); 95 'ready', this.onAuthReady_.bind(this));
97 this.gaiaAuthHost_.retrieveAuthenticatedUserEmailCallback =
98 this.onRetrieveAuthenticatedUserEmail_.bind(this);
99 this.gaiaAuthHost_.confirmPasswordCallback = 96 this.gaiaAuthHost_.confirmPasswordCallback =
100 this.onAuthConfirmPassword_.bind(this); 97 this.onAuthConfirmPassword_.bind(this);
101 this.gaiaAuthHost_.noPasswordCallback = 98 this.gaiaAuthHost_.noPasswordCallback =
102 this.onAuthNoPassword_.bind(this); 99 this.onAuthNoPassword_.bind(this);
103 this.gaiaAuthHost_.insecureContentBlockedCallback = 100 this.gaiaAuthHost_.insecureContentBlockedCallback =
104 this.onInsecureContentBlocked_.bind(this); 101 this.onInsecureContentBlocked_.bind(this);
102 this.gaiaAuthHost_.showFatalAuthErrorCallback =
103 this.showFatalAuthError.bind(this);
105 this.gaiaAuthHost_.addEventListener('authFlowChange', 104 this.gaiaAuthHost_.addEventListener('authFlowChange',
106 this.onAuthFlowChange_.bind(this)); 105 this.onAuthFlowChange_.bind(this));
107 106
108 $('enterprise-info-hint-link').addEventListener('click', function(e) { 107 $('enterprise-info-hint-link').addEventListener('click', function(e) {
109 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); 108 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]);
110 e.preventDefault(); 109 e.preventDefault();
111 }); 110 });
112 111
113 112
114 this.updateLocalizedContent(); 113 this.updateLocalizedContent();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 $('createAccount').hidden && 330 $('createAccount').hidden &&
332 $('guestSignin').hidden && 331 $('guestSignin').hidden &&
333 $('createSupervisedUserPane').hidden && 332 $('createSupervisedUserPane').hidden &&
334 $('consumerManagementEnrollment').hidden; 333 $('consumerManagementEnrollment').hidden;
335 this.classList.toggle('no-right-panel', noRightPanel); 334 this.classList.toggle('no-right-panel', noRightPanel);
336 if (Oobe.getInstance().currentScreen === this) 335 if (Oobe.getInstance().currentScreen === this)
337 Oobe.getInstance().updateScreenSize(this); 336 Oobe.getInstance().updateScreenSize(this);
338 }, 337 },
339 338
340 /** 339 /**
341 * Sends the authenticated user's e-mail address to the auth extension.
342 * @param {number} attemptToken The opaque token provided to
343 * onRetrieveAuthenticatedUserEmail_.
344 * @param {string} email The authenticated user's e-mail address.
345 */
346 setAuthenticatedUserEmail: function(attemptToken, email) {
347 if (!email) {
348 this.showFatalAuthError(
349 loadTimeData.getString('fatalErrorMessageNoEmail'));
350 } else {
351 this.gaiaAuthHost_.setAuthenticatedUserEmail(attemptToken, email);
352 }
353 },
354
355 /**
356 * Updates [Cancel] button state. Allow cancellation of screen only when 340 * Updates [Cancel] button state. Allow cancellation of screen only when
357 * user pods can be displayed. 341 * user pods can be displayed.
358 */ 342 */
359 updateCancelButtonState: function() { 343 updateCancelButtonState: function() {
360 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length; 344 this.cancelAllowed_ = this.isShowUsers_ && $('pod-row').pods.length;
361 $('login-header-bar').allowCancel = this.cancelAllowed_; 345 $('login-header-bar').allowCancel = this.cancelAllowed_;
362 }, 346 },
363 347
364 /** 348 /**
365 * Whether the current auth flow is SAML. 349 * Whether the current auth flow is SAML.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } 390 }
407 391
408 chrome.send('loginWebuiReady'); 392 chrome.send('loginWebuiReady');
409 chrome.send('loginVisible', ['gaia-signin']); 393 chrome.send('loginVisible', ['gaia-signin']);
410 394
411 // Warm up the user images screen. 395 // Warm up the user images screen.
412 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER}); 396 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER});
413 }, 397 },
414 398
415 /** 399 /**
416 * Invoked when the user has successfully authenticated via SAML and the
417 * auth host needs to retrieve the user's e-mail.
418 * @param {number} attemptToken Opaque token to be passed to
419 * setAuthenticatedUserEmail along with the e-mail address.
420 * @param {boolean} apiUsed Whether the principals API was used during
421 * authentication.
422 * @private
423 */
424 onRetrieveAuthenticatedUserEmail_: function(attemptToken, apiUsed) {
425 if (apiUsed) {
426 // If the principals API was used, report this to the C++ backend so
427 // that statistics can be kept. If password scraping was used instead,
428 // there is no need to inform the C++ backend at this point: Either
429 // onAuthNoPassword_ or onAuthConfirmPassword_ will be called in a
430 // moment, both of which imply to the backend that the API was not used.
431 chrome.send('usingSAMLAPI');
bartfab (slow) 2014/10/17 09:54:55 We still need to inform the C++ backend that the A
Roger Tawa OOO till Jul 10th 2014/10/20 16:04:00 Done.
432 }
433 chrome.send('retrieveAuthenticatedUserEmail', [attemptToken]);
434 },
435
436 /**
437 * Invoked when the user has successfully authenticated via SAML, the 400 * Invoked when the user has successfully authenticated via SAML, the
438 * principals API was not used and the auth host needs the user to confirm 401 * principals API was not used and the auth host needs the user to confirm
439 * the scraped password. 402 * the scraped password.
440 * @param {number} passwordCount The number of passwords that were scraped. 403 * @param {number} passwordCount The number of passwords that were scraped.
441 * @private 404 * @private
442 */ 405 */
443 onAuthConfirmPassword_: function(passwordCount) { 406 onAuthConfirmPassword_: function(passwordCount) {
444 this.loading = true; 407 this.loading = true;
445 Oobe.getInstance().headerHidden = false; 408 Oobe.getInstance().headerHidden = false;
446 409
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 467
505 /** 468 /**
506 * Invoked when auth is completed successfully. 469 * Invoked when auth is completed successfully.
507 * @param {!Object} credentials Credentials of the completed authentication. 470 * @param {!Object} credentials Credentials of the completed authentication.
508 * @private 471 * @private
509 */ 472 */
510 onAuthCompleted_: function(credentials) { 473 onAuthCompleted_: function(credentials) {
511 if (credentials.useOffline) { 474 if (credentials.useOffline) {
512 this.email = credentials.email; 475 this.email = credentials.email;
513 chrome.send('authenticateUser', 476 chrome.send('authenticateUser',
514 [credentials.email, credentials.password]); 477 [credentials.gaiaId,
478 credentials.email,
479 credentials.password]);
515 } else if (credentials.authCode) { 480 } else if (credentials.authCode) {
516 chrome.send('completeAuthentication', 481 chrome.send('completeAuthentication',
517 [credentials.email, 482 [credentials.gaiaId,
483 credentials.email,
518 credentials.password, 484 credentials.password,
519 credentials.authCode]); 485 credentials.authCode]);
520 } else { 486 } else {
521 chrome.send('completeLogin', 487 chrome.send('completeLogin',
522 [credentials.email, 488 [credentials.gaiaId,
489 credentials.email,
523 credentials.password, 490 credentials.password,
524 credentials.usingSAML]); 491 credentials.usingSAML]);
525 } 492 }
526 493
527 this.loading = true; 494 this.loading = true;
528 // Now that we're in logged in state header should be hidden. 495 // Now that we're in logged in state header should be hidden.
529 Oobe.getInstance().headerHidden = true; 496 Oobe.getInstance().headerHidden = true;
530 // Clear any error messages that were shown before login. 497 // Clear any error messages that were shown before login.
531 Oobe.clearErrors(); 498 Oobe.clearErrors();
532 }, 499 },
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 * For more info see C++ class 'WebUILoginView' which calls this method. 615 * For more info see C++ class 'WebUILoginView' which calls this method.
649 * @param {number} error Error code. 616 * @param {number} error Error code.
650 * @param {string} url The URL that failed to load. 617 * @param {string} url The URL that failed to load.
651 */ 618 */
652 onFrameError: function(error, url) { 619 onFrameError: function(error, url) {
653 this.error_ = error; 620 this.error_ = error;
654 chrome.send('frameLoadingCompleted', [this.error_]); 621 chrome.send('frameLoadingCompleted', [this.error_]);
655 }, 622 },
656 }; 623 };
657 }); 624 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698