| 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 "chrome/browser/chromeos/login/managed/managed_user_creation_controller
_new.h" | 5 #include "chrome/browser/chromeos/login/managed/managed_user_creation_controller
_new.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Plain text password, hashed and salted with individual salt. | 260 // Plain text password, hashed and salted with individual salt. |
| 261 // It can be used for mounting homedir, and can be replaced only when signed. | 261 // It can be used for mounting homedir, and can be replaced only when signed. |
| 262 cryptohome::KeyDefinition password_key(creation_context_->salted_password, | 262 cryptohome::KeyDefinition password_key(creation_context_->salted_password, |
| 263 kCryptohomeManagedUserKeyLabel, | 263 kCryptohomeManagedUserKeyLabel, |
| 264 kCryptohomeManagedUserKeyPrivileges); | 264 kCryptohomeManagedUserKeyPrivileges); |
| 265 base::Base64Decode(creation_context_->encryption_key, | 265 base::Base64Decode(creation_context_->encryption_key, |
| 266 &password_key.encryption_key); | 266 &password_key.encryption_key); |
| 267 base::Base64Decode(creation_context_->signature_key, | 267 base::Base64Decode(creation_context_->signature_key, |
| 268 &password_key.signature_key); | 268 &password_key.signature_key); |
| 269 | 269 |
| 270 UserContext context(creation_context_->local_user_id, | 270 UserContext context(creation_context_->local_user_id); |
| 271 creation_context_->salted_master_key, | 271 context.SetPassword(creation_context_->salted_master_key); |
| 272 std::string()); | |
| 273 context.SetIsUsingOAuth(false); | |
| 274 context.SetDoesNeedPasswordHashing(false); | 272 context.SetDoesNeedPasswordHashing(false); |
| 275 context.SetKeyLabel(kCryptohomeMasterKeyLabel); | 273 context.SetKeyLabel(kCryptohomeMasterKeyLabel); |
| 274 context.SetIsUsingOAuth(false); |
| 276 | 275 |
| 277 authenticator_->AddKey( | 276 authenticator_->AddKey( |
| 278 context, | 277 context, |
| 279 password_key, | 278 password_key, |
| 280 true, | 279 true, |
| 281 base::Bind(&ManagedUserCreationControllerNew::OnAddKeySuccess, | 280 base::Bind(&ManagedUserCreationControllerNew::OnAddKeySuccess, |
| 282 weak_factory_.GetWeakPtr())); | 281 weak_factory_.GetWeakPtr())); |
| 283 } | 282 } |
| 284 | 283 |
| 285 void ManagedUserCreationControllerNew::OnAddKeySuccess() { | 284 void ManagedUserCreationControllerNew::OnAddKeySuccess() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 creation_context_->registration_utility.reset(); | 386 creation_context_->registration_utility.reset(); |
| 388 chrome::AttemptUserExit(); | 387 chrome::AttemptUserExit(); |
| 389 } | 388 } |
| 390 | 389 |
| 391 std::string ManagedUserCreationControllerNew::GetManagedUserId() { | 390 std::string ManagedUserCreationControllerNew::GetManagedUserId() { |
| 392 DCHECK(creation_context_); | 391 DCHECK(creation_context_); |
| 393 return creation_context_->local_user_id; | 392 return creation_context_->local_user_id; |
| 394 } | 393 } |
| 395 | 394 |
| 396 } // namespace chromeos | 395 } // namespace chromeos |
| OLD | NEW |