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

Unified Diff: components/policy/core/common/cloud/cloud_policy_validator.h

Issue 2150603002: Added policy device id validation similar to the existing DM token validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added policy device id validation similar to the existing DM token validation. BUG: 360708 Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: components/policy/core/common/cloud/cloud_policy_validator.h
diff --git a/components/policy/core/common/cloud/cloud_policy_validator.h b/components/policy/core/common/cloud/cloud_policy_validator.h
index fd1677bf6c63a313c155d735a7b450d1c2cb228b..7e88a268432c00f479c410ae980496c79a245db8 100644
--- a/components/policy/core/common/cloud/cloud_policy_validator.h
+++ b/components/policy/core/common/cloud/cloud_policy_validator.h
@@ -80,6 +80,8 @@ class POLICY_EXPORT CloudPolicyValidatorBase {
// Policy key signature could not be verified using the hard-coded
// verification key.
VALIDATION_BAD_KEY_VERIFICATION_SIGNATURE,
+ // Device id doesn't match.
+ VALIDATION_WRONG_DEVICE_ID,
VALIDATION_STATUS_SIZE // MUST BE LAST
};
@@ -145,6 +147,10 @@ class POLICY_EXPORT CloudPolicyValidatorBase {
void ValidateDMToken(const std::string& dm_token,
ValidateDMTokenOption dm_token_option);
+ // Makes sure the device id on the policy is non-empty and matches
+ // |expected_device_id| unless |expected_device_id| is empty.
+ void ValidateDeviceId(const std::string& dm_token);
+
// Validates the policy type.
void ValidatePolicyType(const std::string& policy_type);
@@ -222,6 +228,7 @@ class POLICY_EXPORT CloudPolicyValidatorBase {
VALIDATE_SIGNATURE = 1 << 7,
VALIDATE_INITIAL_KEY = 1 << 8,
VALIDATE_CACHED_KEY = 1 << 9,
+ VALIDATE_DEVICE_ID = 1 << 10,
};
enum SignatureType {
@@ -267,6 +274,7 @@ class POLICY_EXPORT CloudPolicyValidatorBase {
Status CheckUsername();
Status CheckDomain();
Status CheckToken();
+ Status CheckDeviceId();
Status CheckPolicyType();
Status CheckEntityId();
Status CheckPayload();
@@ -295,6 +303,7 @@ class POLICY_EXPORT CloudPolicyValidatorBase {
bool canonicalize_user_;
std::string domain_;
std::string token_;
+ std::string device_id_;
std::string policy_type_;
std::string settings_entity_id_;
std::string key_;
« no previous file with comments | « components/policy/core/browser/cloud/message_util.cc ('k') | components/policy/core/common/cloud/cloud_policy_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698