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

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.cc

Issue 2507423002: Remove unnecessary plumbing for policy verification key (Closed)
Patch Set: git cl format and rebase. 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/policy/device_cloud_policy_store_chromeos.h" 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 !device_settings_service_->policy_data() || !public_key.get() || 54 !device_settings_service_->policy_data() || !public_key.get() ||
55 !public_key->is_loaded()) { 55 !public_key->is_loaded()) {
56 status_ = STATUS_BAD_STATE; 56 status_ = STATUS_BAD_STATE;
57 NotifyStoreError(); 57 NotifyStoreError();
58 return; 58 return;
59 } 59 }
60 60
61 std::unique_ptr<DeviceCloudPolicyValidator> validator( 61 std::unique_ptr<DeviceCloudPolicyValidator> validator(
62 CreateValidator(policy)); 62 CreateValidator(policy));
63 validator->ValidateSignatureAllowingRotation( 63 validator->ValidateSignatureAllowingRotation(
64 public_key->as_string(), GetPolicyVerificationKey(), 64 public_key->as_string(), install_attributes_->GetDomain());
65 install_attributes_->GetDomain());
66 validator->ValidateAgainstCurrentPolicy( 65 validator->ValidateAgainstCurrentPolicy(
67 device_settings_service_->policy_data(), 66 device_settings_service_->policy_data(),
68 CloudPolicyValidatorBase::TIMESTAMP_FULLY_VALIDATED, 67 CloudPolicyValidatorBase::TIMESTAMP_FULLY_VALIDATED,
69 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED, 68 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED,
70 CloudPolicyValidatorBase::DEVICE_ID_REQUIRED); 69 CloudPolicyValidatorBase::DEVICE_ID_REQUIRED);
71 validator.release()->StartValidation( 70 validator.release()->StartValidation(
72 base::Bind(&DeviceCloudPolicyStoreChromeOS::OnPolicyToStoreValidated, 71 base::Bind(&DeviceCloudPolicyStoreChromeOS::OnPolicyToStoreValidated,
73 weak_factory_.GetWeakPtr())); 72 weak_factory_.GetWeakPtr()));
74 } 73 }
75 74
76 void DeviceCloudPolicyStoreChromeOS::Load() { 75 void DeviceCloudPolicyStoreChromeOS::Load() {
77 device_settings_service_->Load(); 76 device_settings_service_->Load();
78 } 77 }
79 78
80 void DeviceCloudPolicyStoreChromeOS::InstallInitialPolicy( 79 void DeviceCloudPolicyStoreChromeOS::InstallInitialPolicy(
81 const em::PolicyFetchResponse& policy) { 80 const em::PolicyFetchResponse& policy) {
82 // Cancel all pending requests. 81 // Cancel all pending requests.
83 weak_factory_.InvalidateWeakPtrs(); 82 weak_factory_.InvalidateWeakPtrs();
84 83
85 if (!install_attributes_->IsCloudManaged()) { 84 if (!install_attributes_->IsCloudManaged()) {
86 status_ = STATUS_BAD_STATE; 85 status_ = STATUS_BAD_STATE;
87 NotifyStoreError(); 86 NotifyStoreError();
88 return; 87 return;
89 } 88 }
90 89
91 std::unique_ptr<DeviceCloudPolicyValidator> validator( 90 std::unique_ptr<DeviceCloudPolicyValidator> validator(
92 CreateValidator(policy)); 91 CreateValidator(policy));
93 validator->ValidateInitialKey(GetPolicyVerificationKey(), 92 validator->ValidateInitialKey(install_attributes_->GetDomain());
94 install_attributes_->GetDomain());
95 validator.release()->StartValidation( 93 validator.release()->StartValidation(
96 base::Bind(&DeviceCloudPolicyStoreChromeOS::OnPolicyToStoreValidated, 94 base::Bind(&DeviceCloudPolicyStoreChromeOS::OnPolicyToStoreValidated,
97 weak_factory_.GetWeakPtr())); 95 weak_factory_.GetWeakPtr()));
98 } 96 }
99 97
100 void DeviceCloudPolicyStoreChromeOS::DeviceSettingsUpdated() { 98 void DeviceCloudPolicyStoreChromeOS::DeviceSettingsUpdated() {
101 if (!weak_factory_.HasWeakPtrs()) 99 if (!weak_factory_.HasWeakPtrs())
102 UpdateFromService(); 100 UpdateFromService();
103 } 101 }
104 102
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, true); 232 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, true);
235 } else { 233 } else {
236 LOG(ERROR) << "Device policy read on enrolled device yields " 234 LOG(ERROR) << "Device policy read on enrolled device yields "
237 << "no DM token! Status: " << service_status << "."; 235 << "no DM token! Status: " << service_status << ".";
238 chromeos::StartupUtils::MarkEnrollmentRecoveryRequired(); 236 chromeos::StartupUtils::MarkEnrollmentRecoveryRequired();
239 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, false); 237 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, false);
240 } 238 }
241 } 239 }
242 240
243 } // namespace policy 241 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698