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

Side by Side Diff: chromeos/login/auth/cryptohome_authenticator.cc

Issue 517653002: Make CryptohomeAuthenticator's Login*() methods work with pre-hashed keys (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_3_367847_add_sha256_key_type
Patch Set: Addressed comments. Created 6 years, 3 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
« no previous file with comments | « chromeos/login/auth/cryptohome_authenticator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chromeos/login/auth/cryptohome_authenticator.h" 5 #include "chromeos/login/auth/cryptohome_authenticator.h"
6 6
7 #include "base/basictypes.h"
7 #include "base/bind.h" 8 #include "base/bind.h"
8 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
9 #include "base/location.h" 10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "chromeos/cryptohome/async_method_caller.h" 12 #include "chromeos/cryptohome/async_method_caller.h"
12 #include "chromeos/cryptohome/cryptohome_parameters.h" 13 #include "chromeos/cryptohome/cryptohome_parameters.h"
13 #include "chromeos/cryptohome/homedir_methods.h" 14 #include "chromeos/cryptohome/homedir_methods.h"
14 #include "chromeos/cryptohome/system_salt_getter.h" 15 #include "chromeos/cryptohome/system_salt_getter.h"
15 #include "chromeos/dbus/cryptohome_client.h" 16 #include "chromeos/dbus/cryptohome_client.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 17 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "chromeos/login/auth/auth_status_consumer.h" 18 #include "chromeos/login/auth/auth_status_consumer.h"
18 #include "chromeos/login/auth/key.h" 19 #include "chromeos/login/auth/key.h"
19 #include "chromeos/login/auth/user_context.h" 20 #include "chromeos/login/auth/user_context.h"
20 #include "chromeos/login/login_state.h" 21 #include "chromeos/login/login_state.h"
21 #include "chromeos/login/user_names.h" 22 #include "chromeos/login/user_names.h"
22 #include "chromeos/login_event_recorder.h" 23 #include "chromeos/login_event_recorder.h"
23 #include "components/user_manager/user_type.h" 24 #include "components/user_manager/user_type.h"
24 #include "third_party/cros_system_api/dbus/service_constants.h" 25 #include "third_party/cros_system_api/dbus/service_constants.h"
25 26
26 namespace chromeos { 27 namespace chromeos {
27 28
28 namespace { 29 namespace {
29 30
30 // The label used for the key derived from the user's GAIA credentials. 31 // The label used for the key derived from the user's GAIA credentials.
31 const char kCryptohomeGAIAKeyLabel[] = "gaia"; 32 const char kCryptohomeGAIAKeyLabel[] = "gaia";
32 33
34 // The name under which the type of key generated from the user's GAIA
35 // credentials is stored.
36 const char kKeyProviderDataTypeName[] = "type";
37
38 // The name under which the salt used to generate a key from the user's GAIA
39 // credentials is stored.
40 const char kKeyProviderDataSaltName[] = "salt";
41
33 // Hashes |key| with |system_salt| if it its type is KEY_TYPE_PASSWORD_PLAIN. 42 // Hashes |key| with |system_salt| if it its type is KEY_TYPE_PASSWORD_PLAIN.
34 // Returns the keys unmodified otherwise. 43 // Returns the keys unmodified otherwise.
35 scoped_ptr<Key> TransformKeyIfNeeded(const Key& key, 44 scoped_ptr<Key> TransformKeyIfNeeded(const Key& key,
36 const std::string& system_salt) { 45 const std::string& system_salt) {
37 scoped_ptr<Key> result(new Key(key)); 46 scoped_ptr<Key> result(new Key(key));
38 if (result->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN) 47 if (result->GetKeyType() == Key::KEY_TYPE_PASSWORD_PLAIN)
39 result->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt); 48 result->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, system_salt);
40 49
41 return result.Pass(); 50 return result.Pass();
42 } 51 }
(...skipping 23 matching lines...) Expand all
66 void TriggerResolveWithLoginTimeMarker( 75 void TriggerResolveWithLoginTimeMarker(
67 const std::string& marker_name, 76 const std::string& marker_name,
68 AuthAttemptState* attempt, 77 AuthAttemptState* attempt,
69 scoped_refptr<CryptohomeAuthenticator> resolver, 78 scoped_refptr<CryptohomeAuthenticator> resolver,
70 bool success, 79 bool success,
71 cryptohome::MountError return_code) { 80 cryptohome::MountError return_code) {
72 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(marker_name, false); 81 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(marker_name, false);
73 TriggerResolve(attempt, resolver, success, return_code); 82 TriggerResolve(attempt, resolver, success, return_code);
74 } 83 }
75 84
76 void TriggerResolveWithHashAndLoginTimeMarker( 85 // Records an error in accessing the user's cryptohome with the given key and
77 const std::string& marker_name, 86 // calls resolver->Resolve() after adding a login time marker.
78 AuthAttemptState* attempt, 87 void RecordKeyErrorAndResolve(AuthAttemptState* attempt,
79 scoped_refptr<CryptohomeAuthenticator> resolver, 88 scoped_refptr<CryptohomeAuthenticator> resolver) {
80 bool success, 89 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker("CryptohomeMount-End",
81 cryptohome::MountError return_code, 90 false);
82 const std::string& mount_hash) { 91 attempt->RecordCryptohomeStatus(false /* success */,
83 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(marker_name, false); 92 cryptohome::MOUNT_ERROR_KEY_FAILURE);
93 resolver->Resolve();
94 }
95
96 // Callback invoked when cryptohome's MountEx() method has finished.
97 void OnMount(AuthAttemptState* attempt,
98 scoped_refptr<CryptohomeAuthenticator> resolver,
99 bool success,
100 cryptohome::MountError return_code,
101 const std::string& mount_hash) {
102 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker("CryptohomeMount-End",
103 false);
84 attempt->RecordCryptohomeStatus(success, return_code); 104 attempt->RecordCryptohomeStatus(success, return_code);
85 if (success) 105 if (success)
86 attempt->RecordUsernameHash(mount_hash); 106 attempt->RecordUsernameHash(mount_hash);
87 else 107 else
88 attempt->RecordUsernameHashFailed(); 108 attempt->RecordUsernameHashFailed();
89 resolver->Resolve(); 109 resolver->Resolve();
90 } 110 }
91 111
92 // Calls cryptohome's mount method. 112 // Calls cryptohome's MountEx() method. The key in |attempt->user_context| must
93 void Mount(AuthAttemptState* attempt, 113 // not be a plain text password. If the user provided a plain text password,
94 scoped_refptr<CryptohomeAuthenticator> resolver, 114 // that password must be transformed to another key type (by salted hashing)
95 bool ephemeral, 115 // before calling this method.
96 bool create_if_nonexistent, 116 void DoMount(AuthAttemptState* attempt,
97 const std::string& system_salt) { 117 scoped_refptr<CryptohomeAuthenticator> resolver,
98 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker( 118 bool ephemeral,
99 "CryptohomeMount-Start", false); 119 bool create_if_nonexistent) {
120 const Key* key = attempt->user_context.GetKey();
121 // If the |key| is a plain text password, crash rather than attempting to
122 // mount the cryptohome with a plain text password.
123 CHECK_NE(Key::KEY_TYPE_PASSWORD_PLAIN, key->GetKeyType());
124
100 // Set state that username_hash is requested here so that test implementation 125 // Set state that username_hash is requested here so that test implementation
101 // that returns directly would not generate 2 OnLoginSucces() calls. 126 // that returns directly would not generate 2 OnLoginSucces() calls.
102 attempt->UsernameHashRequested(); 127 attempt->UsernameHashRequested();
103 128
104 scoped_ptr<Key> key =
105 TransformKeyIfNeeded(*attempt->user_context.GetKey(), system_salt);
106 // Set the authentication's key label to an empty string, which is a wildcard 129 // Set the authentication's key label to an empty string, which is a wildcard
107 // allowing any key to match. This is necessary because cryptohomes created by 130 // allowing any key to match. This is necessary because cryptohomes created by
108 // Chrome OS M38 and older will have a legacy key with no label while those 131 // Chrome OS M38 and older will have a legacy key with no label while those
109 // created by Chrome OS M39 and newer will have a key with the label 132 // created by Chrome OS M39 and newer will have a key with the label
110 // kCryptohomeGAIAKeyLabel. 133 // kCryptohomeGAIAKeyLabel.
111 const cryptohome::KeyDefinition auth_key(key->GetSecret(), 134 const cryptohome::KeyDefinition auth_key(key->GetSecret(),
112 std::string(), 135 std::string(),
113 cryptohome::PRIV_DEFAULT); 136 cryptohome::PRIV_DEFAULT);
114 cryptohome::MountParameters mount(ephemeral); 137 cryptohome::MountParameters mount(ephemeral);
115 if (create_if_nonexistent) { 138 if (create_if_nonexistent) {
116 mount.create_keys.push_back(cryptohome::KeyDefinition( 139 mount.create_keys.push_back(cryptohome::KeyDefinition(
117 key->GetSecret(), 140 key->GetSecret(),
118 kCryptohomeGAIAKeyLabel, 141 kCryptohomeGAIAKeyLabel,
119 cryptohome::PRIV_DEFAULT)); 142 cryptohome::PRIV_DEFAULT));
120 } 143 }
121 144
122 cryptohome::HomedirMethods::GetInstance()->MountEx( 145 cryptohome::HomedirMethods::GetInstance()->MountEx(
123 cryptohome::Identification(attempt->user_context.GetUserID()), 146 cryptohome::Identification(attempt->user_context.GetUserID()),
124 cryptohome::Authorization(auth_key), 147 cryptohome::Authorization(auth_key),
125 mount, 148 mount,
126 base::Bind(&TriggerResolveWithHashAndLoginTimeMarker, 149 base::Bind(&OnMount, attempt, resolver));
127 "CryptohomeMount-End", 150 }
151
152 // Callback invoked when the system salt has been retrieved. Transforms the key
153 // in |attempt->user_context| using Chrome's default hashing algorithm and the
154 // system salt, then calls MountEx().
155 void OnGetSystemSalt(AuthAttemptState* attempt,
156 scoped_refptr<CryptohomeAuthenticator> resolver,
157 bool ephemeral,
158 bool create_if_nonexistent,
159 const std::string& system_salt) {
160 DCHECK_EQ(Key::KEY_TYPE_PASSWORD_PLAIN,
161 attempt->user_context.GetKey()->GetKeyType());
162
163 attempt->user_context.GetKey()->Transform(
164 Key::KEY_TYPE_SALTED_SHA256_TOP_HALF,
165 system_salt);
166
167 DoMount(attempt, resolver, ephemeral, create_if_nonexistent);
168 }
169
170 // Callback invoked when cryptohome's GetKeyDataEx() method has finished.
171 // * If GetKeyDataEx() returned metadata indicating the hashing algorithm and
172 // salt that were used to generate the key for this user's cryptohome,
173 // transforms the key in |attempt->user_context| with the same parameters.
174 // * Otherwise, starts the retrieval of the system salt so that the key in
175 // |attempt->user_context| can be transformed with Chrome's default hashing
176 // algorithm and the system salt.
177 // The resulting key is then passed to cryptohome's MountEx().
178 void OnGetKeyDataEx(AuthAttemptState* attempt,
179 scoped_refptr<CryptohomeAuthenticator> resolver,
180 bool ephemeral,
181 bool create_if_nonexistent,
182 bool success,
183 cryptohome::MountError return_code,
184 ScopedVector<cryptohome::RetrievedKeyData> key_data) {
185 if (success) {
186 if (key_data.size() == 1) {
187 cryptohome::RetrievedKeyData* key_data_entry = key_data.front();
188 DCHECK_EQ(kCryptohomeGAIAKeyLabel, key_data_entry->label);
189
190 // Extract the key type and salt from |key_data|, if present.
191 scoped_ptr<int64> type;
192 scoped_ptr<std::string> salt;
193 for (ScopedVector<cryptohome::RetrievedKeyData::ProviderData>::
194 const_iterator it = key_data_entry->provider_data.begin();
195 it != key_data_entry->provider_data.end(); ++it) {
196 if ((*it)->name == kKeyProviderDataTypeName) {
197 if ((*it)->number)
198 type.reset(new int64(*(*it)->number));
199 else
200 NOTREACHED();
201 } else if ((*it)->name == kKeyProviderDataSaltName) {
202 if ((*it)->bytes)
203 salt.reset(new std::string(*(*it)->bytes));
204 else
205 NOTREACHED();
206 }
207 }
208
209 if (type) {
210 if (*type < 0 || *type >= Key::KEY_TYPE_COUNT) {
211 LOG(ERROR) << "Invalid key type: " << *type;
212 RecordKeyErrorAndResolve(attempt, resolver);
213 return;
214 }
215
216 if (!salt) {
217 LOG(ERROR) << "Missing salt.";
218 RecordKeyErrorAndResolve(attempt, resolver);
219 return;
220 }
221
222 attempt->user_context.GetKey()->Transform(
223 static_cast<Key::KeyType>(*type),
224 *salt);
225 DoMount(attempt, resolver, ephemeral, create_if_nonexistent);
226 return;
227 }
228 } else {
229 LOG(ERROR) << "GetKeyDataEx() returned " << key_data.size()
230 << " entries.";
231 }
232 }
233
234 SystemSaltGetter::Get()->GetSystemSalt(base::Bind(&OnGetSystemSalt,
235 attempt,
236 resolver,
237 ephemeral,
238 create_if_nonexistent));
239 }
240
241 // Starts the process that will mount a user's cryptohome.
242 // * If the key in |attempt->user_context| is not a plain text password,
243 // cryptohome's MountEx() method is called directly with the key.
244 // * Otherwise, the key must be transformed (by salted hashing) before being
245 // passed to MountEx(). In that case, cryptohome's GetKeyDataEx() method is
246 // called to retrieve metadata indicating the hashing algorithm and salt that
247 // were used to generate the key for this user's cryptohome and the key is
248 // transformed accordingly before calling MountEx().
249 void StartMount(AuthAttemptState* attempt,
250 scoped_refptr<CryptohomeAuthenticator> resolver,
251 bool ephemeral,
252 bool create_if_nonexistent) {
253 chromeos::LoginEventRecorder::Get()->AddLoginTimeMarker(
254 "CryptohomeMount-Start", false);
255
256 if (attempt->user_context.GetKey()->GetKeyType() !=
257 Key::KEY_TYPE_PASSWORD_PLAIN) {
258 DoMount(attempt, resolver, ephemeral, create_if_nonexistent);
259 return;
260 }
261
262 cryptohome::HomedirMethods::GetInstance()->GetKeyDataEx(
263 cryptohome::Identification(attempt->user_context.GetUserID()),
264 kCryptohomeGAIAKeyLabel,
265 base::Bind(&OnGetKeyDataEx,
128 attempt, 266 attempt,
129 resolver)); 267 resolver,
268 ephemeral,
269 create_if_nonexistent));
130 } 270 }
131 271
132 // Calls cryptohome's mount method for guest and also get the user hash from 272 // Calls cryptohome's mount method for guest and also get the user hash from
133 // cryptohome. 273 // cryptohome.
134 void MountGuestAndGetHash(AuthAttemptState* attempt, 274 void MountGuestAndGetHash(AuthAttemptState* attempt,
135 scoped_refptr<CryptohomeAuthenticator> resolver) { 275 scoped_refptr<CryptohomeAuthenticator> resolver) {
136 attempt->UsernameHashRequested(); 276 attempt->UsernameHashRequested();
137 cryptohome::AsyncMethodCaller::GetInstance()->AsyncMountGuest( 277 cryptohome::AsyncMethodCaller::GetInstance()->AsyncMountGuest(
138 base::Bind(&TriggerResolveWithLoginTimeMarker, 278 base::Bind(&TriggerResolveWithLoginTimeMarker,
139 "CryptohomeMount-End", 279 "CryptohomeMount-End",
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 const UserContext& user_context) { 385 const UserContext& user_context) {
246 authentication_profile_ = profile; 386 authentication_profile_ = profile;
247 current_state_.reset(new AuthAttemptState(user_context, 387 current_state_.reset(new AuthAttemptState(user_context,
248 user_manager::USER_TYPE_REGULAR, 388 user_manager::USER_TYPE_REGULAR,
249 false, // unlock 389 false, // unlock
250 false, // online_complete 390 false, // online_complete
251 !IsKnownUser(user_context))); 391 !IsKnownUser(user_context)));
252 // Reset the verified flag. 392 // Reset the verified flag.
253 owner_is_verified_ = false; 393 owner_is_verified_ = false;
254 394
255 SystemSaltGetter::Get()->GetSystemSalt( 395 StartMount(current_state_.get(),
256 base::Bind(&Mount, 396 scoped_refptr<CryptohomeAuthenticator>(this),
257 current_state_.get(), 397 false /* ephemeral */,
258 scoped_refptr<CryptohomeAuthenticator>(this), 398 false /* create_if_nonexistent */);
259 false /* ephemeral */,
260 false /* create_if_nonexistent */));
261 } 399 }
262 400
263 void CryptohomeAuthenticator::CompleteLogin(Profile* profile, 401 void CryptohomeAuthenticator::CompleteLogin(Profile* profile,
264 const UserContext& user_context) { 402 const UserContext& user_context) {
265 authentication_profile_ = profile; 403 authentication_profile_ = profile;
266 current_state_.reset(new AuthAttemptState(user_context, 404 current_state_.reset(new AuthAttemptState(user_context,
267 user_manager::USER_TYPE_REGULAR, 405 user_manager::USER_TYPE_REGULAR,
268 true, // unlock 406 true, // unlock
269 false, // online_complete 407 false, // online_complete
270 !IsKnownUser(user_context))); 408 !IsKnownUser(user_context)));
271 409
272 // Reset the verified flag. 410 // Reset the verified flag.
273 owner_is_verified_ = false; 411 owner_is_verified_ = false;
274 412
275 SystemSaltGetter::Get()->GetSystemSalt( 413 StartMount(current_state_.get(),
276 base::Bind(&Mount, 414 scoped_refptr<CryptohomeAuthenticator>(this),
277 current_state_.get(), 415 false /* ephemeral */,
278 scoped_refptr<CryptohomeAuthenticator>(this), 416 false /* create_if_nonexistent */);
279 false /* ephemeral */,
280 false /* create_if_nonexistent */));
281 417
282 // For login completion from extension, we just need to resolve the current 418 // For login completion from extension, we just need to resolve the current
283 // auth attempt state, the rest of OAuth related tasks will be done in 419 // auth attempt state, the rest of OAuth related tasks will be done in
284 // parallel. 420 // parallel.
285 task_runner_->PostTask( 421 task_runner_->PostTask(
286 FROM_HERE, 422 FROM_HERE,
287 base::Bind(&CryptohomeAuthenticator::ResolveLoginCompletionStatus, this)); 423 base::Bind(&CryptohomeAuthenticator::ResolveLoginCompletionStatus, this));
288 } 424 }
289 425
290 void CryptohomeAuthenticator::AuthenticateToUnlock( 426 void CryptohomeAuthenticator::AuthenticateToUnlock(
(...skipping 14 matching lines...) Expand all
305 void CryptohomeAuthenticator::LoginAsSupervisedUser( 441 void CryptohomeAuthenticator::LoginAsSupervisedUser(
306 const UserContext& user_context) { 442 const UserContext& user_context) {
307 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 443 DCHECK(task_runner_->RunsTasksOnCurrentThread());
308 // TODO(nkostylev): Pass proper value for |user_is_new| or remove (not used). 444 // TODO(nkostylev): Pass proper value for |user_is_new| or remove (not used).
309 current_state_.reset(new AuthAttemptState(user_context, 445 current_state_.reset(new AuthAttemptState(user_context,
310 user_manager::USER_TYPE_SUPERVISED, 446 user_manager::USER_TYPE_SUPERVISED,
311 false, // unlock 447 false, // unlock
312 false, // online_complete 448 false, // online_complete
313 false)); // user_is_new 449 false)); // user_is_new
314 remove_user_data_on_failure_ = false; 450 remove_user_data_on_failure_ = false;
315 SystemSaltGetter::Get()->GetSystemSalt( 451 StartMount(current_state_.get(),
316 base::Bind(&Mount, 452 scoped_refptr<CryptohomeAuthenticator>(this),
317 current_state_.get(), 453 false /* ephemeral */,
318 scoped_refptr<CryptohomeAuthenticator>(this), 454 false /* create_if_nonexistent */);
319 false /* ephemeral */,
320 false /* create_if_nonexistent */));
321 } 455 }
322 456
323 void CryptohomeAuthenticator::LoginRetailMode() { 457 void CryptohomeAuthenticator::LoginRetailMode() {
324 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 458 DCHECK(task_runner_->RunsTasksOnCurrentThread());
325 // Note: |kRetailModeUserEMail| is used in other places to identify a retail 459 // Note: |kRetailModeUserEMail| is used in other places to identify a retail
326 // mode session. 460 // mode session.
327 current_state_.reset( 461 current_state_.reset(
328 new AuthAttemptState(UserContext(chromeos::login::kRetailModeUserName), 462 new AuthAttemptState(UserContext(chromeos::login::kRetailModeUserName),
329 user_manager::USER_TYPE_RETAIL_MODE, 463 user_manager::USER_TYPE_RETAIL_MODE,
330 false, // unlock 464 false, // unlock
(...skipping 23 matching lines...) Expand all
354 const UserContext& user_context) { 488 const UserContext& user_context) {
355 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 489 DCHECK(task_runner_->RunsTasksOnCurrentThread());
356 current_state_.reset( 490 current_state_.reset(
357 new AuthAttemptState(user_context, 491 new AuthAttemptState(user_context,
358 user_manager::USER_TYPE_PUBLIC_ACCOUNT, 492 user_manager::USER_TYPE_PUBLIC_ACCOUNT,
359 false, // unlock 493 false, // unlock
360 false, // online_complete 494 false, // online_complete
361 false)); // user_is_new 495 false)); // user_is_new
362 remove_user_data_on_failure_ = false; 496 remove_user_data_on_failure_ = false;
363 ephemeral_mount_attempted_ = true; 497 ephemeral_mount_attempted_ = true;
364 SystemSaltGetter::Get()->GetSystemSalt( 498 StartMount(current_state_.get(),
365 base::Bind(&Mount, 499 scoped_refptr<CryptohomeAuthenticator>(this),
366 current_state_.get(), 500 true /* ephemeral */,
367 scoped_refptr<CryptohomeAuthenticator>(this), 501 true /* create_if_nonexistent */);
368 true /* ephemeral */,
369 true /* create_if_nonexistent */));
370 } 502 }
371 503
372 void CryptohomeAuthenticator::LoginAsKioskAccount( 504 void CryptohomeAuthenticator::LoginAsKioskAccount(
373 const std::string& app_user_id, 505 const std::string& app_user_id,
374 bool use_guest_mount) { 506 bool use_guest_mount) {
375 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 507 DCHECK(task_runner_->RunsTasksOnCurrentThread());
376 508
377 const std::string user_id = 509 const std::string user_id =
378 use_guest_mount ? chromeos::login::kGuestUserName : app_user_id; 510 use_guest_mount ? chromeos::login::kGuestUserName : app_user_id;
379 current_state_.reset(new AuthAttemptState(UserContext(user_id), 511 current_state_.reset(new AuthAttemptState(UserContext(user_id),
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 remove_user_data_on_failure_ = false; 694 remove_user_data_on_failure_ = false;
563 task_runner_->PostTask(FROM_HERE, 695 task_runner_->PostTask(FROM_HERE,
564 base::Bind(&CryptohomeAuthenticator::OnAuthFailure, 696 base::Bind(&CryptohomeAuthenticator::OnAuthFailure,
565 this, 697 this,
566 *delayed_login_failure_)); 698 *delayed_login_failure_));
567 break; 699 break;
568 case CREATE_NEW: 700 case CREATE_NEW:
569 create_if_nonexistent = true; 701 create_if_nonexistent = true;
570 case RECOVER_MOUNT: 702 case RECOVER_MOUNT:
571 current_state_->ResetCryptohomeStatus(); 703 current_state_->ResetCryptohomeStatus();
572 SystemSaltGetter::Get()->GetSystemSalt( 704 StartMount(current_state_.get(),
573 base::Bind(&Mount, 705 scoped_refptr<CryptohomeAuthenticator>(this),
574 current_state_.get(), 706 false /*ephemeral*/,
575 scoped_refptr<CryptohomeAuthenticator>(this), 707 create_if_nonexistent);
576 false /*ephemeral*/,
577 create_if_nonexistent));
578 break; 708 break;
579 case NEED_OLD_PW: 709 case NEED_OLD_PW:
580 task_runner_->PostTask( 710 task_runner_->PostTask(
581 FROM_HERE, 711 FROM_HERE,
582 base::Bind(&CryptohomeAuthenticator::OnPasswordChangeDetected, this)); 712 base::Bind(&CryptohomeAuthenticator::OnPasswordChangeDetected, this));
583 break; 713 break;
584 case ONLINE_FAILED: 714 case ONLINE_FAILED:
585 case NEED_NEW_PW: 715 case NEED_NEW_PW:
586 case HAVE_NEW_PW: 716 case HAVE_NEW_PW:
587 NOTREACHED() << "Using obsolete ClientLogin code path."; 717 NOTREACHED() << "Using obsolete ClientLogin code path.";
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 Resolve(); 918 Resolve();
789 } 919 }
790 920
791 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished, 921 void CryptohomeAuthenticator::SetOwnerState(bool owner_check_finished,
792 bool check_result) { 922 bool check_result) {
793 owner_is_verified_ = owner_check_finished; 923 owner_is_verified_ = owner_check_finished;
794 user_can_login_ = check_result; 924 user_can_login_ = check_result;
795 } 925 }
796 926
797 } // namespace chromeos 927 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/auth/cryptohome_authenticator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698