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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc

Issue 671183002: Revert of 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: 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 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/chromeos/login/gaia_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 builder->Add("createAccount", IDS_CREATE_ACCOUNT_HTML); 260 builder->Add("createAccount", IDS_CREATE_ACCOUNT_HTML);
261 builder->Add("guestSignin", IDS_BROWSE_WITHOUT_SIGNING_IN_HTML); 261 builder->Add("guestSignin", IDS_BROWSE_WITHOUT_SIGNING_IN_HTML);
262 builder->Add("createSupervisedUser", 262 builder->Add("createSupervisedUser",
263 IDS_CREATE_SUPERVISED_USER_HTML); 263 IDS_CREATE_SUPERVISED_USER_HTML);
264 builder->Add("createSupervisedUserFeatureName", 264 builder->Add("createSupervisedUserFeatureName",
265 IDS_CREATE_SUPERVISED_USER_FEATURE_NAME); 265 IDS_CREATE_SUPERVISED_USER_FEATURE_NAME);
266 builder->Add("consumerManagementEnrollmentSigninMessage", 266 builder->Add("consumerManagementEnrollmentSigninMessage",
267 IDS_LOGIN_CONSUMER_MANAGEMENT_ENROLLMENT); 267 IDS_LOGIN_CONSUMER_MANAGEMENT_ENROLLMENT);
268 268
269 // Strings used by the SAML fatal error dialog. 269 // Strings used by the SAML fatal error dialog.
270 builder->Add("fatalErrorMessageNoAccountDetails", 270 builder->Add("fatalErrorMessageNoEmail", IDS_LOGIN_FATAL_ERROR_NO_EMAIL);
271 IDS_LOGIN_FATAL_ERROR_NO_ACCOUNT_DETAILS);
272 builder->Add("fatalErrorMessageNoPassword", 271 builder->Add("fatalErrorMessageNoPassword",
273 IDS_LOGIN_FATAL_ERROR_NO_PASSWORD); 272 IDS_LOGIN_FATAL_ERROR_NO_PASSWORD);
274 builder->Add("fatalErrorMessageVerificationFailed", 273 builder->Add("fatalErrorMessageVerificationFailed",
275 IDS_LOGIN_FATAL_ERROR_PASSWORD_VERIFICATION); 274 IDS_LOGIN_FATAL_ERROR_PASSWORD_VERIFICATION);
276 builder->Add("fatalErrorMessageInsecureURL", 275 builder->Add("fatalErrorMessageInsecureURL",
277 IDS_LOGIN_FATAL_ERROR_TEXT_INSECURE_URL); 276 IDS_LOGIN_FATAL_ERROR_TEXT_INSECURE_URL);
278 builder->Add("fatalErrorInstructions", IDS_LOGIN_FATAL_ERROR_INSTRUCTIONS); 277 builder->Add("fatalErrorInstructions", IDS_LOGIN_FATAL_ERROR_INSTRUCTIONS);
279 builder->Add("fatalErrorDismissButton", IDS_OK); 278 builder->Add("fatalErrorDismissButton", IDS_OK);
280 } 279 }
281 280
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 312
314 if (network_state_informer_->state() != NetworkStateInformer::ONLINE) 313 if (network_state_informer_->state() != NetworkStateInformer::ONLINE)
315 return; 314 return;
316 if (frame_state_ == FRAME_STATE_LOADED) 315 if (frame_state_ == FRAME_STATE_LOADED)
317 UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE); 316 UpdateState(ErrorScreenActor::ERROR_REASON_UPDATE);
318 else if (frame_state_ == FRAME_STATE_ERROR) 317 else if (frame_state_ == FRAME_STATE_ERROR)
319 UpdateState(ErrorScreenActor::ERROR_REASON_FRAME_ERROR); 318 UpdateState(ErrorScreenActor::ERROR_REASON_FRAME_ERROR);
320 } 319 }
321 320
322 void GaiaScreenHandler::HandleCompleteAuthentication( 321 void GaiaScreenHandler::HandleCompleteAuthentication(
323 const std::string& gaia_id,
324 const std::string& email, 322 const std::string& email,
325 const std::string& password, 323 const std::string& password,
326 const std::string& auth_code) { 324 const std::string& auth_code) {
327 if (!Delegate()) 325 if (!Delegate())
328 return; 326 return;
329
330 DCHECK(!email.empty());
331 DCHECK(!gaia_id.empty());
332 Delegate()->SetDisplayEmail(gaia::SanitizeEmail(email)); 327 Delegate()->SetDisplayEmail(gaia::SanitizeEmail(email));
333 UserContext user_context(email); 328 UserContext user_context(email);
334 user_context.SetGaiaID(gaia_id);
335 user_context.SetKey(Key(password)); 329 user_context.SetKey(Key(password));
336 user_context.SetAuthCode(auth_code); 330 user_context.SetAuthCode(auth_code);
337 Delegate()->CompleteLogin(user_context); 331 Delegate()->CompleteLogin(user_context);
338 } 332 }
339 333
340 void GaiaScreenHandler::HandleCompleteLogin(const std::string& gaia_id, 334 void GaiaScreenHandler::HandleCompleteLogin(const std::string& typed_email,
341 const std::string& typed_email,
342 const std::string& password, 335 const std::string& password,
343 bool using_saml) { 336 bool using_saml) {
344 if (!is_enrolling_consumer_management_) { 337 if (!is_enrolling_consumer_management_) {
345 DoCompleteLogin(gaia_id, typed_email, password, using_saml); 338 DoCompleteLogin(typed_email, password, using_saml);
346 return; 339 return;
347 } 340 }
348 341
349 // Consumer management enrollment is in progress. 342 // Consumer management enrollment is in progress.
350 const std::string owner_email = 343 const std::string owner_email =
351 user_manager::UserManager::Get()->GetOwnerEmail(); 344 user_manager::UserManager::Get()->GetOwnerEmail();
352 if (typed_email != owner_email) { 345 if (typed_email != owner_email) {
353 // Show Gaia sign-in screen again, since we only allow the owner to sign 346 // Show Gaia sign-in screen again, since we only allow the owner to sign
354 // in. 347 // in.
355 populated_email_ = owner_email; 348 populated_email_ = owner_email;
356 ShowGaia(is_enrolling_consumer_management_); 349 ShowGaia(is_enrolling_consumer_management_);
357 return; 350 return;
358 } 351 }
359 352
360 CHECK(consumer_management_); 353 CHECK(consumer_management_);
361 consumer_management_->SetOwner(owner_email, 354 consumer_management_->SetOwner(owner_email,
362 base::Bind(&GaiaScreenHandler::OnSetOwnerDone, 355 base::Bind(&GaiaScreenHandler::OnSetOwnerDone,
363 weak_factory_.GetWeakPtr(), 356 weak_factory_.GetWeakPtr(),
364 gaia_id,
365 typed_email, 357 typed_email,
366 password, 358 password,
367 using_saml)); 359 using_saml));
368 } 360 }
369 361
370 void GaiaScreenHandler::HandleUsingSAMLAPI() { 362 void GaiaScreenHandler::HandleUsingSAMLAPI() {
371 SetSAMLPrincipalsAPIUsed(true); 363 SetSAMLPrincipalsAPIUsed(true);
372 } 364 }
373 365
374 void GaiaScreenHandler::HandleScrapedPasswordCount(int password_count) { 366 void GaiaScreenHandler::HandleScrapedPasswordCount(int password_count) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // focus to current pod (see crbug/175243). 410 // focus to current pod (see crbug/175243).
419 DCHECK(signin_screen_handler_); 411 DCHECK(signin_screen_handler_);
420 signin_screen_handler_->RefocusCurrentPod(); 412 signin_screen_handler_->RefocusCurrentPod();
421 } 413 }
422 HandleFrameLoadingCompleted(0); 414 HandleFrameLoadingCompleted(0);
423 415
424 if (test_expects_complete_login_) 416 if (test_expects_complete_login_)
425 SubmitLoginFormForTest(); 417 SubmitLoginFormForTest();
426 } 418 }
427 419
428 void GaiaScreenHandler::OnSetOwnerDone(const std::string& gaia_id, 420 void GaiaScreenHandler::OnSetOwnerDone(const std::string& typed_email,
429 const std::string& typed_email,
430 const std::string& password, 421 const std::string& password,
431 bool using_saml, 422 bool using_saml,
432 bool success) { 423 bool success) {
433 CHECK(consumer_management_); 424 CHECK(consumer_management_);
434 if (success) { 425 if (success) {
435 consumer_management_->SetEnrollmentStage( 426 consumer_management_->SetEnrollmentStage(
436 policy::ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED); 427 policy::ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED);
437 } else { 428 } else {
438 LOG(ERROR) << "Failed to write owner e-mail to boot lockbox."; 429 LOG(ERROR) << "Failed to write owner e-mail to boot lockbox.";
439 consumer_management_->SetEnrollmentStage( 430 consumer_management_->SetEnrollmentStage(
440 policy::ConsumerManagementService:: 431 policy::ConsumerManagementService::
441 ENROLLMENT_STAGE_BOOT_LOCKBOX_FAILED); 432 ENROLLMENT_STAGE_BOOT_LOCKBOX_FAILED);
442 // We should continue logging in the user, as there's not much we can do 433 // We should continue logging in the user, as there's not much we can do
443 // here. 434 // here.
444 } 435 }
445 DoCompleteLogin(gaia_id, typed_email, password, using_saml); 436 DoCompleteLogin(typed_email, password, using_saml);
446 } 437 }
447 438
448 void GaiaScreenHandler::DoCompleteLogin(const std::string& gaia_id, 439 void GaiaScreenHandler::DoCompleteLogin(const std::string& typed_email,
449 const std::string& typed_email,
450 const std::string& password, 440 const std::string& password,
451 bool using_saml) { 441 bool using_saml) {
452 if (!Delegate()) 442 if (!Delegate())
453 return; 443 return;
454 444
455 if (using_saml && !using_saml_api_) 445 if (using_saml && !using_saml_api_)
456 RecordSAMLScrapingVerificationResultInHistogram(true); 446 RecordSAMLScrapingVerificationResultInHistogram(true);
457 447
458 DCHECK(!typed_email.empty());
459 DCHECK(!gaia_id.empty());
460 const std::string sanitized_email = gaia::SanitizeEmail(typed_email); 448 const std::string sanitized_email = gaia::SanitizeEmail(typed_email);
461 Delegate()->SetDisplayEmail(sanitized_email); 449 Delegate()->SetDisplayEmail(sanitized_email);
462 UserContext user_context(sanitized_email); 450 UserContext user_context(sanitized_email);
463 user_context.SetGaiaID(gaia_id);
464 user_context.SetKey(Key(password)); 451 user_context.SetKey(Key(password));
465 user_context.SetAuthFlow(using_saml 452 user_context.SetAuthFlow(using_saml
466 ? UserContext::AUTH_FLOW_GAIA_WITH_SAML 453 ? UserContext::AUTH_FLOW_GAIA_WITH_SAML
467 : UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); 454 : UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML);
468 Delegate()->CompleteLogin(user_context); 455 Delegate()->CompleteLogin(user_context);
469 456
470 if (test_expects_complete_login_) { 457 if (test_expects_complete_login_) {
471 VLOG(2) << "Complete test login for " << typed_email 458 VLOG(2) << "Complete test login for " << typed_email
472 << ", requested=" << test_user_; 459 << ", requested=" << test_user_;
473 460
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 689
703 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { 690 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() {
704 DCHECK(signin_screen_handler_); 691 DCHECK(signin_screen_handler_);
705 return signin_screen_handler_->delegate_; 692 return signin_screen_handler_->delegate_;
706 } 693 }
707 694
708 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { 695 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) {
709 signin_screen_handler_ = handler; 696 signin_screen_handler_ = handler;
710 } 697 }
711 } // namespace chromeos 698 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698