Chromium Code Reviews| Index: chromeos/login/auth/cryptohome_authenticator.cc |
| diff --git a/chromeos/login/auth/cryptohome_authenticator.cc b/chromeos/login/auth/cryptohome_authenticator.cc |
| index 4321adfc241e0f0c7eca20a76c00d7dfdbae47cc..dd72327108dd1b4b2ce6fcd02a5c862e1f3bda9f 100644 |
| --- a/chromeos/login/auth/cryptohome_authenticator.cc |
| +++ b/chromeos/login/auth/cryptohome_authenticator.cc |
| @@ -25,6 +25,7 @@ |
| #include "chromeos/login/user_names.h" |
| #include "chromeos/login_event_recorder.h" |
| #include "components/device_event_log/device_event_log.h" |
| +#include "components/signin/core/account_id/account_id.h" |
| #include "components/user_manager/user_type.h" |
| #include "third_party/cros_system_api/dbus/service_constants.h" |
| @@ -147,9 +148,9 @@ void DoMount(const base::WeakPtr<AuthAttemptState>& attempt, |
| } |
| cryptohome::HomedirMethods::GetInstance()->MountEx( |
| - cryptohome::Identification(attempt->user_context.GetUserID()), |
| - cryptohome::Authorization(auth_key), |
| - mount, |
| + cryptohome::Identification( |
| + attempt->user_context.GetAccountId().GetUserEmail()), |
|
achuithb
2015/10/28 23:11:46
does GetUserEmail() return canonicalized email?
Alexander Alekseev
2015/10/29 02:00:42
Not. And this is bad.
But this all works, because
|
| + cryptohome::Authorization(auth_key), mount, |
| base::Bind(&OnMount, attempt, resolver)); |
| } |
| @@ -265,13 +266,10 @@ void StartMount(const base::WeakPtr<AuthAttemptState>& attempt, |
| } |
| cryptohome::HomedirMethods::GetInstance()->GetKeyDataEx( |
| - cryptohome::Identification(attempt->user_context.GetUserID()), |
| - kCryptohomeGAIAKeyLabel, |
| - base::Bind(&OnGetKeyDataEx, |
| - attempt, |
| - resolver, |
| - ephemeral, |
| - create_if_nonexistent)); |
| + cryptohome::Identification( |
| + attempt->user_context.GetAccountId().GetUserEmail()), |
| + kCryptohomeGAIAKeyLabel, base::Bind(&OnGetKeyDataEx, attempt, resolver, |
| + ephemeral, create_if_nonexistent)); |
| } |
| // Calls cryptohome's mount method for guest and also get the user hash from |
| @@ -285,7 +283,7 @@ void MountGuestAndGetHash(const base::WeakPtr<AuthAttemptState>& attempt, |
| attempt, |
| resolver)); |
| cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( |
| - attempt->user_context.GetUserID(), |
| + attempt->user_context.GetAccountId().GetUserEmail(), |
| base::Bind(&TriggerResolveHash, attempt, resolver)); |
| } |
| @@ -294,14 +292,11 @@ void MountPublic(const base::WeakPtr<AuthAttemptState>& attempt, |
| scoped_refptr<CryptohomeAuthenticator> resolver, |
| int flags) { |
| cryptohome::AsyncMethodCaller::GetInstance()->AsyncMountPublic( |
| - attempt->user_context.GetUserID(), |
| - flags, |
| + attempt->user_context.GetAccountId().GetUserEmail(), flags, |
| base::Bind(&TriggerResolveWithLoginTimeMarker, |
| - "CryptohomeMountPublic-End", |
| - attempt, |
| - resolver)); |
| + "CryptohomeMountPublic-End", attempt, resolver)); |
| cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( |
| - attempt->user_context.GetUserID(), |
| + attempt->user_context.GetAccountId().GetUserEmail(), |
| base::Bind(&TriggerResolveHash, attempt, resolver)); |
| } |
| @@ -323,21 +318,17 @@ void Migrate(const base::WeakPtr<AuthAttemptState>& attempt, |
| scoped_ptr<Key> new_key = |
| TransformKeyIfNeeded(*attempt->user_context.GetKey(), system_salt); |
| if (passing_old_hash) { |
| - caller->AsyncMigrateKey(attempt->user_context.GetUserID(), |
| - old_key->GetSecret(), |
| - new_key->GetSecret(), |
| - base::Bind(&TriggerResolveWithLoginTimeMarker, |
| - "CryptohomeMount-End", |
| - attempt, |
| - resolver)); |
| + caller->AsyncMigrateKey( |
| + attempt->user_context.GetAccountId().GetUserEmail(), |
| + old_key->GetSecret(), new_key->GetSecret(), |
| + base::Bind(&TriggerResolveWithLoginTimeMarker, "CryptohomeMount-End", |
| + attempt, resolver)); |
| } else { |
| - caller->AsyncMigrateKey(attempt->user_context.GetUserID(), |
| - new_key->GetSecret(), |
| - old_key->GetSecret(), |
| - base::Bind(&TriggerResolveWithLoginTimeMarker, |
| - "CryptohomeMount-End", |
| - attempt, |
| - resolver)); |
| + caller->AsyncMigrateKey( |
| + attempt->user_context.GetAccountId().GetUserEmail(), |
| + new_key->GetSecret(), old_key->GetSecret(), |
| + base::Bind(&TriggerResolveWithLoginTimeMarker, "CryptohomeMount-End", |
| + attempt, resolver)); |
| } |
| } |
| @@ -347,11 +338,9 @@ void Remove(const base::WeakPtr<AuthAttemptState>& attempt, |
| chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker( |
| "CryptohomeRemove-Start", false); |
| cryptohome::AsyncMethodCaller::GetInstance()->AsyncRemove( |
| - attempt->user_context.GetUserID(), |
| - base::Bind(&TriggerResolveWithLoginTimeMarker, |
| - "CryptohomeRemove-End", |
| - attempt, |
| - resolver)); |
| + attempt->user_context.GetAccountId().GetUserEmail(), |
| + base::Bind(&TriggerResolveWithLoginTimeMarker, "CryptohomeRemove-End", |
| + attempt, resolver)); |
| } |
| // Calls cryptohome's key check method. |
| @@ -361,8 +350,7 @@ void CheckKey(const base::WeakPtr<AuthAttemptState>& attempt, |
| scoped_ptr<Key> key = |
| TransformKeyIfNeeded(*attempt->user_context.GetKey(), system_salt); |
| cryptohome::AsyncMethodCaller::GetInstance()->AsyncCheckKey( |
| - attempt->user_context.GetUserID(), |
| - key->GetSecret(), |
| + attempt->user_context.GetAccountId().GetUserEmail(), key->GetSecret(), |
| base::Bind(&TriggerResolve, attempt, resolver)); |
| } |