| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace chromeos { | 26 namespace chromeos { |
| 27 class CryptohomeClient; | 27 class CryptohomeClient; |
| 28 class SessionManagerClient; | 28 class SessionManagerClient; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace policy { | 31 namespace policy { |
| 32 | 32 |
| 33 // Implements a cloud policy store backed by the Chrome OS' session_manager, | 33 // Implements a policy store backed by the Chrome OS' session_manager, which |
| 34 // which takes care of persisting policy to disk and is accessed via DBus calls | 34 // takes care of persisting policy to disk and is accessed via DBus calls |
| 35 // through SessionManagerClient. | 35 // through SessionManagerClient. |
| 36 // TODO(tnagel): Rename class to reflect that it can store Active Directory |
| 37 // policy as well. Also think about whether it would make more sense to keep |
| 38 // cloud and AD policy stores separate and to extract the common functionality |
| 39 // somewhere else. |
| 36 class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase { | 40 class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase { |
| 37 public: | 41 public: |
| 42 // Policy validation is relaxed when |is_active_directory| is set, most |
| 43 // notably signature validation is disabled. It is essential that this flag |
| 44 // is only set when install attributes are locked into Active Directory mode. |
| 38 UserCloudPolicyStoreChromeOS( | 45 UserCloudPolicyStoreChromeOS( |
| 39 chromeos::CryptohomeClient* cryptohome_client, | 46 chromeos::CryptohomeClient* cryptohome_client, |
| 40 chromeos::SessionManagerClient* session_manager_client, | 47 chromeos::SessionManagerClient* session_manager_client, |
| 41 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 48 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
| 42 const AccountId& account_id, | 49 const AccountId& account_id, |
| 43 const base::FilePath& user_policy_key_dir); | 50 const base::FilePath& user_policy_key_dir, |
| 51 bool is_active_directory); |
| 44 ~UserCloudPolicyStoreChromeOS() override; | 52 ~UserCloudPolicyStoreChromeOS() override; |
| 45 | 53 |
| 46 // CloudPolicyStore: | 54 // CloudPolicyStore: |
| 47 void Store(const enterprise_management::PolicyFetchResponse& policy) override; | 55 void Store(const enterprise_management::PolicyFetchResponse& policy) override; |
| 48 void Load() override; | 56 void Load() override; |
| 49 | 57 |
| 50 // Loads the policy synchronously on the current thread. | 58 // Loads the policy synchronously on the current thread. |
| 51 void LoadImmediately(); | 59 void LoadImmediately(); |
| 52 | 60 |
| 53 private: | 61 private: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 chromeos::DBusMethodCallStatus call_status, | 101 chromeos::DBusMethodCallStatus call_status, |
| 94 const std::string& sanitized_username); | 102 const std::string& sanitized_username); |
| 95 | 103 |
| 96 std::unique_ptr<UserCloudPolicyValidator> CreateValidatorForLoad( | 104 std::unique_ptr<UserCloudPolicyValidator> CreateValidatorForLoad( |
| 97 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); | 105 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy); |
| 98 | 106 |
| 99 chromeos::CryptohomeClient* cryptohome_client_; | 107 chromeos::CryptohomeClient* cryptohome_client_; |
| 100 chromeos::SessionManagerClient* session_manager_client_; | 108 chromeos::SessionManagerClient* session_manager_client_; |
| 101 const AccountId account_id_; | 109 const AccountId account_id_; |
| 102 base::FilePath user_policy_key_dir_; | 110 base::FilePath user_policy_key_dir_; |
| 111 bool is_active_directory_; |
| 103 | 112 |
| 104 // The current key used to verify signatures of policy. This value is loaded | 113 // The current key used to verify signatures of policy. This value is loaded |
| 105 // from the key cache file (which is owned and kept up to date by the Chrome | 114 // from the key cache file (which is owned and kept up to date by the Chrome |
| 106 // OS session manager). This is, generally, different from | 115 // OS session manager). This is, generally, different from |
| 107 // |policy_signature_public_key_|, which always corresponds to the currently | 116 // |policy_signature_public_key_|, which always corresponds to the currently |
| 108 // effective policy. | 117 // effective policy. |
| 109 std::string cached_policy_key_; | 118 std::string cached_policy_key_; |
| 110 bool cached_policy_key_loaded_ = false; | 119 bool cached_policy_key_loaded_ = false; |
| 111 base::FilePath cached_policy_key_path_; | 120 base::FilePath cached_policy_key_path_; |
| 112 | 121 |
| 113 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; | 122 base::WeakPtrFactory<UserCloudPolicyStoreChromeOS> weak_factory_; |
| 114 | 123 |
| 115 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); | 124 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreChromeOS); |
| 116 }; | 125 }; |
| 117 | 126 |
| 118 } // namespace policy | 127 } // namespace policy |
| 119 | 128 |
| 120 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ | 129 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_STORE_CHROMEOS_H_ |
| OLD | NEW |