OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/login/auth/cryptohome_authenticator.h" | 5 #include "chromeos/login/auth/cryptohome_authenticator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( | 286 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( |
287 attempt->user_context.GetUserID(), | 287 attempt->user_context.GetUserID(), |
288 base::Bind(&TriggerResolveHash, attempt, resolver)); | 288 base::Bind(&TriggerResolveHash, attempt, resolver)); |
289 } | 289 } |
290 | 290 |
291 // Calls cryptohome's MountPublic method | 291 // Calls cryptohome's MountPublic method |
292 void MountPublic(const base::WeakPtr<AuthAttemptState>& attempt, | 292 void MountPublic(const base::WeakPtr<AuthAttemptState>& attempt, |
293 scoped_refptr<CryptohomeAuthenticator> resolver, | 293 scoped_refptr<CryptohomeAuthenticator> resolver, |
294 int flags) { | 294 int flags) { |
295 cryptohome::AsyncMethodCaller::GetInstance()->AsyncMountPublic( | 295 cryptohome::AsyncMethodCaller::GetInstance()->AsyncMountPublic( |
296 attempt->user_context.GetUserID(), | 296 attempt->user_context.GetUserID().GetUserEmail(), |
297 flags, | 297 flags, |
298 base::Bind(&TriggerResolveWithLoginTimeMarker, | 298 base::Bind(&TriggerResolveWithLoginTimeMarker, |
299 "CryptohomeMountPublic-End", | 299 "CryptohomeMountPublic-End", |
300 attempt, | 300 attempt, |
301 resolver)); | 301 resolver)); |
302 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( | 302 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( |
303 attempt->user_context.GetUserID(), | 303 attempt->user_context.GetUserID(), |
304 base::Bind(&TriggerResolveHash, attempt, resolver)); | 304 base::Bind(&TriggerResolveHash, attempt, resolver)); |
305 } | 305 } |
306 | 306 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 remove_user_data_on_failure_ = false; | 452 remove_user_data_on_failure_ = false; |
453 StartMount(current_state_->AsWeakPtr(), | 453 StartMount(current_state_->AsWeakPtr(), |
454 scoped_refptr<CryptohomeAuthenticator>(this), | 454 scoped_refptr<CryptohomeAuthenticator>(this), |
455 false /* ephemeral */, false /* create_if_nonexistent */); | 455 false /* ephemeral */, false /* create_if_nonexistent */); |
456 } | 456 } |
457 | 457 |
458 void CryptohomeAuthenticator::LoginOffTheRecord() { | 458 void CryptohomeAuthenticator::LoginOffTheRecord() { |
459 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 459 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
460 current_state_.reset( | 460 current_state_.reset( |
461 new AuthAttemptState(UserContext(user_manager::USER_TYPE_GUEST, | 461 new AuthAttemptState(UserContext(user_manager::USER_TYPE_GUEST, |
462 chromeos::login::kGuestUserName), | 462 chromeos::login::GetGuestUserID()), |
463 false, // unlock | 463 false, // unlock |
464 false, // online_complete | 464 false, // online_complete |
465 false)); // user_is_new | 465 false)); // user_is_new |
466 remove_user_data_on_failure_ = false; | 466 remove_user_data_on_failure_ = false; |
467 ephemeral_mount_attempted_ = true; | 467 ephemeral_mount_attempted_ = true; |
468 MountGuestAndGetHash(current_state_->AsWeakPtr(), | 468 MountGuestAndGetHash(current_state_->AsWeakPtr(), |
469 scoped_refptr<CryptohomeAuthenticator>(this)); | 469 scoped_refptr<CryptohomeAuthenticator>(this)); |
470 } | 470 } |
471 | 471 |
472 void CryptohomeAuthenticator::LoginAsPublicSession( | 472 void CryptohomeAuthenticator::LoginAsPublicSession( |
473 const UserContext& user_context) { | 473 const UserContext& user_context) { |
474 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 474 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
475 DCHECK_EQ(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user_context.GetUserType()); | 475 DCHECK_EQ(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user_context.GetUserType()); |
476 | 476 |
477 current_state_.reset( | 477 current_state_.reset( |
478 new AuthAttemptState(user_context, | 478 new AuthAttemptState(user_context, |
479 false, // unlock | 479 false, // unlock |
480 false, // online_complete | 480 false, // online_complete |
481 false)); // user_is_new | 481 false)); // user_is_new |
482 remove_user_data_on_failure_ = false; | 482 remove_user_data_on_failure_ = false; |
483 ephemeral_mount_attempted_ = true; | 483 ephemeral_mount_attempted_ = true; |
484 StartMount(current_state_->AsWeakPtr(), | 484 StartMount(current_state_->AsWeakPtr(), |
485 scoped_refptr<CryptohomeAuthenticator>(this), true /* ephemeral */, | 485 scoped_refptr<CryptohomeAuthenticator>(this), true /* ephemeral */, |
486 true /* create_if_nonexistent */); | 486 true /* create_if_nonexistent */); |
487 } | 487 } |
488 | 488 |
489 void CryptohomeAuthenticator::LoginAsKioskAccount( | 489 void CryptohomeAuthenticator::LoginAsKioskAccount( |
490 const std::string& app_user_id, | 490 const user_manager::UserID& app_user_id, |
491 bool use_guest_mount) { | 491 bool use_guest_mount) { |
492 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 492 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
493 | 493 |
494 const std::string user_id = | 494 const user_manager::UserID user_id = |
495 use_guest_mount ? chromeos::login::kGuestUserName : app_user_id; | 495 use_guest_mount ? chromeos::login::GetGuestUserID() : app_user_id; |
496 current_state_.reset(new AuthAttemptState( | 496 current_state_.reset(new AuthAttemptState( |
497 UserContext(user_manager::USER_TYPE_KIOSK_APP, user_id), | 497 UserContext(user_manager::USER_TYPE_KIOSK_APP, user_id), |
498 false, // unlock | 498 false, // unlock |
499 false, // online_complete | 499 false, // online_complete |
500 false)); // user_is_new | 500 false)); // user_is_new |
501 | 501 |
502 remove_user_data_on_failure_ = true; | 502 remove_user_data_on_failure_ = true; |
503 if (!use_guest_mount) { | 503 if (!use_guest_mount) { |
504 MountPublic(current_state_->AsWeakPtr(), | 504 MountPublic(current_state_->AsWeakPtr(), |
505 scoped_refptr<CryptohomeAuthenticator>(this), | 505 scoped_refptr<CryptohomeAuthenticator>(this), |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 Resolve(); | 880 Resolve(); |
881 } | 881 } |
882 | 882 |
883 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, | 883 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, |
884 bool check_result) { | 884 bool check_result) { |
885 owner_is_verified_ = owner_check_finished; | 885 owner_is_verified_ = owner_check_finished; |
886 user_can_login_ = check_result; | 886 user_can_login_ = check_result; |
887 } | 887 } |
888 | 888 |
889 } // namespace chromeos | 889 } // namespace chromeos |
OLD | NEW |