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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 862103002: Only store leading 13 bits of password hash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make LocalAuth a class so methods can be private and exposed only to tests. Created 5 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/value_conversions.h" 10 #include "base/value_conversions.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 const ProfileInfoCache& info_cache = 334 const ProfileInfoCache& info_cache =
335 g_browser_process->profile_manager()->GetProfileInfoCache(); 335 g_browser_process->profile_manager()->GetProfileInfoCache();
336 size_t profile_index = info_cache.GetIndexOfProfileWithPath(profile_path); 336 size_t profile_index = info_cache.GetIndexOfProfileWithPath(profile_path);
337 337
338 if (profile_index == std::string::npos) { 338 if (profile_index == std::string::npos) {
339 NOTREACHED(); 339 NOTREACHED();
340 return; 340 return;
341 } 341 }
342 342
343 authenticating_profile_index_ = profile_index; 343 authenticating_profile_index_ = profile_index;
344 if (!chrome::ValidateLocalAuthCredentials(profile_index, password)) { 344 if (!LocalAuth::ValidateLocalAuthCredentials(profile_index, password)) {
345 // Make a second attempt via an on-line authentication call. This handles 345 // Make a second attempt via an on-line authentication call. This handles
346 // profiles that are missing sign-in credentials and also cases where the 346 // profiles that are missing sign-in credentials and also cases where the
347 // password has been changed externally. 347 // password has been changed externally.
348 client_login_.reset(new GaiaAuthFetcher( 348 client_login_.reset(new GaiaAuthFetcher(
349 this, 349 this,
350 GaiaConstants::kChromeSource, 350 GaiaConstants::kChromeSource,
351 web_ui()->GetWebContents()->GetBrowserContext()->GetRequestContext())); 351 web_ui()->GetWebContents()->GetBrowserContext()->GetRequestContext()));
352 352
353 client_login_->StartClientLogin( 353 client_login_->StartClientLogin(
354 base::UTF16ToUTF8(email_address), 354 base::UTF16ToUTF8(email_address),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 std::string email; 446 std::string email;
447 CHECK(args->GetString(0, &email)); 447 CHECK(args->GetString(0, &email));
448 SetAuthType(email, 448 SetAuthType(email,
449 ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD, 449 ScreenlockBridge::LockHandler::FORCE_OFFLINE_PASSWORD,
450 base::string16()); 450 base::string16());
451 HideUserPodCustomIcon(email); 451 HideUserPodCustomIcon(email);
452 } 452 }
453 453
454 void UserManagerScreenHandler::OnClientLoginSuccess( 454 void UserManagerScreenHandler::OnClientLoginSuccess(
455 const ClientLoginResult& result) { 455 const ClientLoginResult& result) {
456 chrome::SetLocalAuthCredentials(authenticating_profile_index_, 456 LocalAuth::SetLocalAuthCredentials(authenticating_profile_index_,
457 password_attempt_); 457 password_attempt_);
458 ReportAuthenticationResult(true, ProfileMetrics::AUTH_ONLINE); 458 ReportAuthenticationResult(true, ProfileMetrics::AUTH_ONLINE);
459 } 459 }
460 460
461 void UserManagerScreenHandler::OnClientLoginFailure( 461 void UserManagerScreenHandler::OnClientLoginFailure(
462 const GoogleServiceAuthError& error) { 462 const GoogleServiceAuthError& error) {
463 const GoogleServiceAuthError::State state = error.state(); 463 const GoogleServiceAuthError::State state = error.state();
464 // Some "error" results mean the password was correct but some other action 464 // Some "error" results mean the password was correct but some other action
465 // should be taken. For our purposes, we only care that the password was 465 // should be taken. For our purposes, we only care that the password was
466 // correct so count those as a success. 466 // correct so count those as a success.
467 bool success = (state == GoogleServiceAuthError::NONE || 467 bool success = (state == GoogleServiceAuthError::NONE ||
468 state == GoogleServiceAuthError::CAPTCHA_REQUIRED || 468 state == GoogleServiceAuthError::CAPTCHA_REQUIRED ||
469 state == GoogleServiceAuthError::TWO_FACTOR || 469 state == GoogleServiceAuthError::TWO_FACTOR ||
470 state == GoogleServiceAuthError::ACCOUNT_DELETED || 470 state == GoogleServiceAuthError::ACCOUNT_DELETED ||
471 state == GoogleServiceAuthError::ACCOUNT_DISABLED || 471 state == GoogleServiceAuthError::ACCOUNT_DISABLED ||
472 state == GoogleServiceAuthError::WEB_LOGIN_REQUIRED); 472 state == GoogleServiceAuthError::WEB_LOGIN_REQUIRED);
473 473
474 // If the password was correct, the user must have changed it since the 474 // If the password was correct, the user must have changed it since the
475 // profile was locked. Save the password to streamline future unlocks. 475 // profile was locked. Save the password to streamline future unlocks.
476 if (success) { 476 if (success) {
477 DCHECK(!password_attempt_.empty()); 477 DCHECK(!password_attempt_.empty());
478 chrome::SetLocalAuthCredentials(authenticating_profile_index_, 478 LocalAuth::SetLocalAuthCredentials(authenticating_profile_index_,
479 password_attempt_); 479 password_attempt_);
480 } 480 }
481 481
482 bool offline = (state == GoogleServiceAuthError::CONNECTION_FAILED || 482 bool offline = (state == GoogleServiceAuthError::CONNECTION_FAILED ||
483 state == GoogleServiceAuthError::SERVICE_UNAVAILABLE || 483 state == GoogleServiceAuthError::SERVICE_UNAVAILABLE ||
484 state == GoogleServiceAuthError::REQUEST_CANCELED); 484 state == GoogleServiceAuthError::REQUEST_CANCELED);
485 ProfileMetrics::ProfileAuth failure_metric = 485 ProfileMetrics::ProfileAuth failure_metric =
486 offline ? ProfileMetrics::AUTH_FAILED_OFFLINE : 486 offline ? ProfileMetrics::AUTH_FAILED_OFFLINE :
487 ProfileMetrics::AUTH_FAILED; 487 ProfileMetrics::AUTH_FAILED;
488 ReportAuthenticationResult( 488 ReportAuthenticationResult(
489 success, success ? ProfileMetrics::AUTH_ONLINE : failure_metric); 489 success, success ? ProfileMetrics::AUTH_ONLINE : failure_metric);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 Profile* profile, Profile::CreateStatus profile_create_status) { 758 Profile* profile, Profile::CreateStatus profile_create_status) {
759 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); 759 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_);
760 if (browser && browser->window()) { 760 if (browser && browser->window()) {
761 OnBrowserWindowReady(browser); 761 OnBrowserWindowReady(browser);
762 } else { 762 } else {
763 registrar_.Add(this, 763 registrar_.Add(this,
764 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 764 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
765 content::NotificationService::AllSources()); 765 content::NotificationService::AllSources());
766 } 766 }
767 } 767 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/inline_login_handler_impl.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698