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

Side by Side Diff: chrome/browser/chromeos/login/supervised/supervised_user_authenticator.cc

Issue 2529103002: Add account_type into AccountId (Closed)
Patch Set: Created 4 years 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 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 "chrome/browser/chromeos/login/supervised/supervised_user_authenticator .h" 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticator .h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/chromeos/boot_times_recorder.h" 10 #include "chrome/browser/chromeos/boot_times_recorder.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 scoped_refptr<SupervisedUserAuthenticator> resolver, 63 scoped_refptr<SupervisedUserAuthenticator> resolver,
64 int flags, 64 int flags,
65 const std::string& system_salt) { 65 const std::string& system_salt) {
66 DCHECK_CURRENTLY_ON(BrowserThread::UI); 66 DCHECK_CURRENTLY_ON(BrowserThread::UI);
67 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker( 67 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker(
68 "CryptohomeMount-LMU-Start", false); 68 "CryptohomeMount-LMU-Start", false);
69 69
70 Key key(attempt->password); 70 Key key(attempt->password);
71 key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); 71 key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
72 const AccountId account_id = user_manager::known_user::GetAccountId( 72 const AccountId account_id = user_manager::known_user::GetAccountId(
73 attempt->username, std::string() /* gaia_id */); 73 attempt->username, std::string() /* gaia_id */,
74 std::string() /* account_type */);
74 const cryptohome::Identification cryptohome_id(account_id); 75 const cryptohome::Identification cryptohome_id(account_id);
75 cryptohome::AsyncMethodCaller::GetInstance()->AsyncMount( 76 cryptohome::AsyncMethodCaller::GetInstance()->AsyncMount(
76 cryptohome_id, key.GetSecret(), flags, 77 cryptohome_id, key.GetSecret(), flags,
77 base::Bind(&TriggerResolveWithLoginTimeMarker, "CryptohomeMount-LMU-End", 78 base::Bind(&TriggerResolveWithLoginTimeMarker, "CryptohomeMount-LMU-End",
78 attempt, resolver)); 79 attempt, resolver));
79 80
80 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername( 81 cryptohome::AsyncMethodCaller::GetInstance()->AsyncGetSanitizedUsername(
81 cryptohome_id, base::Bind(&TriggerResolveResult, attempt, resolver)); 82 cryptohome_id, base::Bind(&TriggerResolveResult, attempt, resolver));
82 } 83 }
83 84
84 // Calls cryptohome's addKey method. 85 // Calls cryptohome's addKey method.
85 void AddKey(SupervisedUserAuthenticator::AuthAttempt* attempt, 86 void AddKey(SupervisedUserAuthenticator::AuthAttempt* attempt,
86 scoped_refptr<SupervisedUserAuthenticator> resolver, 87 scoped_refptr<SupervisedUserAuthenticator> resolver,
87 const std::string& plain_text_master_key, 88 const std::string& plain_text_master_key,
88 const std::string& system_salt) { 89 const std::string& system_salt) {
89 DCHECK_CURRENTLY_ON(BrowserThread::UI); 90 DCHECK_CURRENTLY_ON(BrowserThread::UI);
90 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker( 91 chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker(
91 "CryptohomeAddKey-LMU-Start", false); 92 "CryptohomeAddKey-LMU-Start", false);
92 93
93 Key user_key(attempt->password); 94 Key user_key(attempt->password);
94 user_key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); 95 user_key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
95 Key master_key(plain_text_master_key); 96 Key master_key(plain_text_master_key);
96 master_key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); 97 master_key.Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
97 const AccountId account_id = user_manager::known_user::GetAccountId( 98 const AccountId account_id = user_manager::known_user::GetAccountId(
98 attempt->username, std::string() /* gaia_id */); 99 attempt->username, std::string() /* gaia_id */,
100 std::string() /* account_type */);
99 cryptohome::AsyncMethodCaller::GetInstance()->AsyncAddKey( 101 cryptohome::AsyncMethodCaller::GetInstance()->AsyncAddKey(
100 cryptohome::Identification(account_id), user_key.GetSecret(), 102 cryptohome::Identification(account_id), user_key.GetSecret(),
101 master_key.GetSecret(), 103 master_key.GetSecret(),
102 base::Bind(&TriggerResolveWithLoginTimeMarker, "CryptohomeAddKey-LMU-End", 104 base::Bind(&TriggerResolveWithLoginTimeMarker, "CryptohomeAddKey-LMU-End",
103 attempt, resolver)); 105 attempt, resolver));
104 } 106 }
105 107
106 } // namespace 108 } // namespace
107 109
108 SupervisedUserAuthenticator::SupervisedUserAuthenticator( 110 SupervisedUserAuthenticator::SupervisedUserAuthenticator(
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 DCHECK_CURRENTLY_ON(BrowserThread::UI); 338 DCHECK_CURRENTLY_ON(BrowserThread::UI);
337 return hash_obtained_; 339 return hash_obtained_;
338 } 340 }
339 341
340 std::string SupervisedUserAuthenticator::AuthAttempt::hash() { 342 std::string SupervisedUserAuthenticator::AuthAttempt::hash() {
341 DCHECK_CURRENTLY_ON(BrowserThread::UI); 343 DCHECK_CURRENTLY_ON(BrowserThread::UI);
342 return hash_; 344 return hash_;
343 } 345 }
344 346
345 } // namespace chromeos 347 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698