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/managed_mode/chromeos/manager_password_service.h" | 5 #include "chrome/browser/managed_mode/chromeos/manager_password_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/login/managed/locally_managed_user_constants.h
" | 10 #include "chrome/browser/chromeos/login/managed/locally_managed_user_constants.h
" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 VLOG(0) << "Password changed for " << user_id; | 185 VLOG(0) << "Password changed for " << user_id; |
186 UMA_HISTOGRAM_ENUMERATION( | 186 UMA_HISTOGRAM_ENUMERATION( |
187 "ManagedUsers.ChromeOS.PasswordChange", | 187 "ManagedUsers.ChromeOS.PasswordChange", |
188 SupervisedUserAuthentication::PASSWORD_CHANGED_IN_MANAGER_SESSION, | 188 SupervisedUserAuthentication::PASSWORD_CHANGED_IN_MANAGER_SESSION, |
189 SupervisedUserAuthentication::PASSWORD_CHANGE_RESULT_MAX_VALUE); | 189 SupervisedUserAuthentication::PASSWORD_CHANGE_RESULT_MAX_VALUE); |
190 | 190 |
191 SupervisedUserAuthentication* auth = | 191 SupervisedUserAuthentication* auth = |
192 UserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); | 192 UserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); |
193 int old_schema = auth->GetPasswordSchema(user_id); | 193 int old_schema = auth->GetPasswordSchema(user_id); |
194 auth->StorePasswordData(user_id, *password_data.get()); | 194 auth->StorePasswordData(user_id, *password_data.get()); |
| 195 |
| 196 if (auth->HasIncompleteKey(user_id)) |
| 197 auth->MarkKeyIncomplete(user_id, false /* key is complete now */); |
| 198 |
| 199 // Check if we have legacy labels for keys. |
| 200 // TODO(antrim): Migrate it to GetLabels call once wad@ implement it. |
195 if (old_schema == SupervisedUserAuthentication::SCHEMA_PLAIN) { | 201 if (old_schema == SupervisedUserAuthentication::SCHEMA_PLAIN) { |
196 // 1) Add new manager key (using old key). | 202 // 1) Add new manager key (using old key). |
197 // 2) Remove old supervised user key. | 203 // 2) Remove old supervised user key. |
198 // 3) Remove old manager key. | 204 // 3) Remove old manager key. |
199 authenticator_->TransformContext( | 205 authenticator_->TransformContext( |
200 master_key_context, | 206 master_key_context, |
201 base::Bind(&ManagerPasswordService::OnContextTransformed, | 207 base::Bind(&ManagerPasswordService::OnContextTransformed, |
202 weak_ptr_factory_.GetWeakPtr())); | 208 weak_ptr_factory_.GetWeakPtr())); |
203 } | 209 } |
204 } | 210 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 void ManagerPasswordService::OnOldManagerKeyDeleted( | 253 void ManagerPasswordService::OnOldManagerKeyDeleted( |
248 const UserContext& master_key_context) { | 254 const UserContext& master_key_context) { |
249 VLOG(1) << "Removed old master key for " << master_key_context.username; | 255 VLOG(1) << "Removed old master key for " << master_key_context.username; |
250 } | 256 } |
251 | 257 |
252 void ManagerPasswordService::Shutdown() { | 258 void ManagerPasswordService::Shutdown() { |
253 settings_service_subscription_.reset(); | 259 settings_service_subscription_.reset(); |
254 } | 260 } |
255 | 261 |
256 } // namespace chromeos | 262 } // namespace chromeos |
OLD | NEW |