summaryrefslogtreecommitdiffstats
path: root/remoting/host/policy_watcher.h
Commit message (Collapse)AuthorAgeFilesLines
* Malformed PortRange or ThirdPartyAuthConfig should trigger OnPolicyError.lukasza2015-03-031-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change a malformed value of RemoteAccessHostUdpPortRange policy (i.e. "123456-blah") was ignored and a default value was used. Similarily for the 3 third-party-auth-config policies (RemoteAccessHostTokenUrl, ...TokenValidationUrl and ...TokenValidationCertificateIssuer) we were falling back to a secure default, but not reporting a policy error. After this change such malformed values will trigger an OnPolicyError callback. Notes: - Guaranteeing that PolicyWatcher always returns valid policy values, removes the need for a "rejecting" Me2MeHostAuthenticatorFactory. - Moving PortRange and ThirdPartyAuthConfig to separate compilation units helps readability elsewhere + encourages better unit tests coverage. - Initially I tried to wrap all policies in a new ChromotingPolicies class, but eventually went back to prevalidating and passing base::DictionaryValue. - Arguments for using ChromotingPolicies: - Helps avoid overtesting in policy_watcher_unittests.cc (i.e. helps focus the tests on a single policy value). - Arguments for using base::DictionaryValue: - Minimizes changes. - Keeps things simple (as opposed to having to introduce a custom equivalent of optional<T> [nothing similar present in Chromium AFAICT]). - Neutral: - Strong-typing of ChromotingPolicies didn't help readability as much as I expected and hoped for. BUG=427513 TEST=remoting_unittests Review URL: https://codereview.chromium.org/966433002 Cr-Commit-Position: refs/heads/master@{#318910}
* Reporting a policy error after detecting mistyped policies.lukasza2015-02-231-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | After this changelist policy::Schema is used to validate policy contents. Mistyped values trigger PolicyWatcher::PolicyErrorCallback. Misspelled names trigger just a LOG(WARNING) message. As a follow-up to using policy::Schema for validation, we can remove ad-hoc fallback values for 2 out of 15 or our policies that used to be stored in PolicyWatcher::bad_type_values_. This can be replaced with a CHECK that verifies that the Schema indeed didn't pass through any mistyped values. As another follow-up we can remove the TODO comment asking to start using PolicyWatcher::PolicyErrorCallback again. We can also remove SignalTransientPolicyError which is not used anymore at this point (we can hesitantly consider reintroducing it if needed to handle detection of unparseable files; this is still some time in the future though). BUG=427513 TEST=remoting_unittests + manual verification on Win and Linux via TestRealChromotingPolicy Review URL: https://codereview.chromium.org/891053003 Cr-Commit-Position: refs/heads/master@{#317646}
* Cleanup threading in PolicyWatcher.sergeyu2015-01-301-31/+12
| | | | | | | | | | | | | | | | | | | Previously PolicyWatcher allowed initialization on a thread different from the one it runs on. It's no longer necessary. Also for It2Me it was initialized on UI thread, but was given task runner for the network thread, which causes the DCHECK in the linked bug. Now PolicyWatcher is marked as NonThreadSafe. It's initialized on UI thread for It2Me host and on NetworkThread for the me2me host. Also the file thread is used for blocking operation when reading policies. BUG=453615 Review URL: https://codereview.chromium.org/886913002 Cr-Commit-Position: refs/heads/master@{#314026}
* Removing policy_hack namespace and directory.lukasza2015-01-291-0/+166
Now we are reusing code from components/policy, so we can get rid of the self-shaming "hack" name in the policy_hack namespace and directory. The changelist also: - Inlines MockPolicyCallback into policy_watcher_unittest.cc - Removes a misguided TODO comment in policy_watcher.h that used to say that components/policy filters out policies that do not match the schema (this is not true for polices from Chrome domain - see SchemaMap::FilterMap definition). BUG=368321 Review URL: https://codereview.chromium.org/884243003 Cr-Commit-Position: refs/heads/master@{#313819}