public void ConfigurationObjectIsModifiedIfThereAreMachinePolicyOverrides()
 {
     configurationObject.Enabled = false;
     machineKey.AddBooleanValue(LogEnabledFilterDataManageabilityProvider.EnabledPropertyName, true);
     provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(configurationObject, true, machineKey, null, true, wmiSettings);
     Assert.AreEqual(true, configurationObject.Enabled);
 }
Beispiel #2
0
        public void ConfigurationObjectIsModifiedIfThereAreMachinePolicyOverrides()
        {
            configurationObject.SaltEnabled   = true;
            configurationObject.AlgorithmType = typeof(SHA1Managed);

            machineKey.AddBooleanValue(HashAlgorithmProviderDataManageabilityProvider.SaltEnabledPropertyName, false);

            provider.OverrideWithGroupPolicies(configurationObject, true, machineKey, userKey);

            Assert.AreEqual(false, configurationObject.SaltEnabled);
        }
Beispiel #3
0
        public void SectionPropertiesAreOverridenFromMachineKey()
        {
            section.DefaultCacheManager = "default";

            machineKey.AddBooleanValue(CacheManagerSettingsManageabilityProvider.PolicyValueName, true);
            machineKey.AddStringValue(CacheManagerSettingsManageabilityProvider.DefaultCacheManagerPropertyName, "machineOverridenDefault");

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual("machineOverridenDefault", section.DefaultCacheManager);
        }
        public void SectionWitUserPolicyOverridesIsModified()
        {
            section.DefaultDatabase = "default";

            userKey.AddBooleanValue(DatabaseSettingsManageabilityProvider.PolicyValueName, true);
            userKey.AddStringValue(DatabaseSettingsManageabilityProvider.DefaultDatabasePropertyName, "overridenDefault");

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, false, wmiSettings);

            Assert.AreEqual("overridenDefault", section.DefaultDatabase);
        }
Beispiel #5
0
        public void SectionPropertiesAreOverridenFromMachineKey()
        {
            section.DefaultHashProviderName            = "default hash";
            section.DefaultSymmetricCryptoProviderName = "default symmetric";

            machineKey.AddBooleanValue(CryptographySettingsManageabilityProvider.PolicyValueName, true);
            machineKey.AddStringValue(CryptographySettingsManageabilityProvider.DefaultHashProviderPropertyName, "machine hash");
            machineKey.AddStringValue(CryptographySettingsManageabilityProvider.DefaultSymmetricCryptoProviderPropertyName, "machine symmetric");

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual("machine hash", section.DefaultHashProviderName);
            Assert.AreEqual("machine symmetric", section.DefaultSymmetricCryptoProviderName);
        }
Beispiel #6
0
        public void SectionPropertiesAreOverridenFromUserKey()
        {
            section.DefaultAuthorizationProviderName = "default authorization";
            section.DefaultSecurityCacheProviderName = "default securitycache";

            userKey.AddBooleanValue(SecuritySettingsManageabilityProvider.PolicyValueName, true);
            userKey.AddStringValue(SecuritySettingsManageabilityProvider.DefaultAuthorizationProviderPropertyName, "user authorization");
            userKey.AddStringValue(SecuritySettingsManageabilityProvider.DefaultSecurityCacheProviderPropertyName, "user securitycache");

            provider.OverrideWithGroupPolicies(section, true, userKey, userKey);

            Assert.AreEqual("user authorization", section.DefaultAuthorizationProviderName);
            Assert.AreEqual("user securitycache", section.DefaultSecurityCacheProviderName);
        }
Beispiel #7
0
        public void CacheManagerWithDisabledPolicyIsRemoved()
        {
            CacheManagerData data1 = new CacheManagerData();

            data1.Name = "cache manager 1";
            section.CacheManagers.Add(data1);
            CacheManagerData data2 = new CacheManagerData();

            data2.Name = "cache manager 2";
            section.CacheManagers.Add(data2);

            MockRegistryKey machineCacheManagersKey = new MockRegistryKey(false);

            machineKey.AddSubKey(CacheManagerSettingsManageabilityProvider.CacheManagersKeyName, machineCacheManagersKey);
            MockRegistryKey machineCacheManager1Key = new MockRegistryKey(false);

            machineCacheManagersKey.AddSubKey("cache manager 1", machineCacheManager1Key);
            machineCacheManager1Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(1, section.CacheManagers.Count);
            Assert.IsNotNull(section.CacheManagers.Get("cache manager 2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineCacheManagersKey, machineCacheManager1Key));
        }
        public void HashProviderWithDisabledPolicyIsRemoved()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(HashAlgorithmProviderData), registeredProvider);
            provider = new CryptographySettingsManageabilityProvider(subProviders);

            HashAlgorithmProviderData hashProvider1Data = new HashAlgorithmProviderData("hashProvider1", typeof(Object), false);

            section.HashProviders.Add(hashProvider1Data);
            HashAlgorithmProviderData hashProvider2Data = new HashAlgorithmProviderData("hashProvider2", typeof(Object), false);

            section.HashProviders.Add(hashProvider2Data);

            MockRegistryKey machineHashProvidersKey = new MockRegistryKey(false);

            machineKey.AddSubKey(CryptographySettingsManageabilityProvider.HashProvidersKeyName, machineHashProvidersKey);
            MockRegistryKey machineHashProvider2Key = new MockRegistryKey(false);

            machineHashProvidersKey.AddSubKey("hashProvider2", machineHashProvider2Key);
            machineHashProvider2Key.AddBooleanValue(CryptographySettingsManageabilityProvider.PolicyValueName, false);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(1, section.HashProviders.Count);
            Assert.IsNotNull(section.HashProviders.Get("hashProvider1"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineHashProvidersKey, machineHashProvider2Key));
        }
Beispiel #9
0
        public void SecurityCacheProviderWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(SecurityCacheProviderData), registeredProvider);
            provider = new SecuritySettingsManageabilityProvider(subProviders);

            SecurityCacheProviderData securityCacheProvider1Data = new SecurityCacheProviderData("securityCacheProvider1", typeof(Object));

            section.SecurityCacheProviders.Add(securityCacheProvider1Data);
            SecurityCacheProviderData securityCacheProvider2Data = new SecurityCacheProviderData("securityCacheProvider2", typeof(Object));

            section.SecurityCacheProviders.Add(securityCacheProvider2Data);

            MockRegistryKey machineSecurityCacheProvidersKey = new MockRegistryKey(false);

            machineKey.AddSubKey(SecuritySettingsManageabilityProvider.SecurityCacheProvidersKeyName, machineSecurityCacheProvidersKey);
            MockRegistryKey machineSecurityCacheProvider2Key = new MockRegistryKey(false);

            machineSecurityCacheProvidersKey.AddSubKey("securityCacheProvider2", machineSecurityCacheProvider2Key);
            machineSecurityCacheProvider2Key.AddBooleanValue(SecuritySettingsManageabilityProvider.PolicyValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.SecurityCacheProviders.Count);
            Assert.IsNotNull(section.SecurityCacheProviders.Get("securityCacheProvider1"));
            Assert.IsNotNull(section.SecurityCacheProviders.Get("securityCacheProvider2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineSecurityCacheProvidersKey, machineSecurityCacheProvider2Key));
        }
        public void OracleConnectionWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            OracleConnectionData connectionData1 = new OracleConnectionData();

            connectionData1.Name = "data1";
            section.OracleConnectionsData.Add(connectionData1);
            OracleConnectionData connectionData2 = new OracleConnectionData();

            connectionData2.Name = "data2";
            section.OracleConnectionsData.Add(connectionData2);

            MockRegistryKey machinePackage1Key = new MockRegistryKey(false);

            machineKey.AddSubKey("data1", machinePackage1Key);
            machinePackage1Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);
            MockRegistryKey machinePackage2Key = new MockRegistryKey(false);

            machineKey.AddSubKey("data2", machinePackage2Key);
            machinePackage2Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, true);
            machinePackage2Key.AddStringValue(OracleConnectionSettingsManageabilityProvider.PackagesPropertyName,
                                              "package24=prefix24");

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(section, false, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(2, section.OracleConnectionsData.Count);
            Assert.IsNotNull(section.OracleConnectionsData.Get("data1"));
            Assert.IsNotNull(section.OracleConnectionsData.Get("data2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machinePackage1Key, machinePackage2Key));
        }
Beispiel #11
0
        public void AuthorizationProviderWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(AuthorizationProviderData), registeredProvider);
            provider = new ConfigurationSectionManageabilityProviderWrapper(
                new SecuritySettingsManageabilityProvider(subProviders));

            AuthorizationProviderData authorizationProvider1Data = new AuthorizationProviderData("authorizationProvider1", typeof(Object));

            section.AuthorizationProviders.Add(authorizationProvider1Data);
            AuthorizationProviderData authorizationProvider2Data = new AuthorizationProviderData("authorizationProvider2", typeof(Object));

            section.AuthorizationProviders.Add(authorizationProvider2Data);

            MockRegistryKey machineAuthorizationProvidersKey = new MockRegistryKey(false);

            machineKey.AddSubKey(SecuritySettingsManageabilityProvider.AuthorizationProvidersKeyName, machineAuthorizationProvidersKey);
            MockRegistryKey machineAuthorizationProvider2Key = new MockRegistryKey(false);

            machineAuthorizationProvidersKey.AddSubKey("authorizationProvider2", machineAuthorizationProvider2Key);
            machineAuthorizationProvider2Key.AddBooleanValue(SecuritySettingsManageabilityProvider.PolicyValueName, false);

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(section, false, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(2, section.AuthorizationProviders.Count);
            Assert.IsNotNull(section.AuthorizationProviders.Get("authorizationProvider1"));
            Assert.IsNotNull(section.AuthorizationProviders.Get("authorizationProvider2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineAuthorizationProvidersKey, machineAuthorizationProvider2Key));
        }
        public void LogFormatterWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            ConnectionStringSettings connectionString1 = new ConnectionStringSettings("cs1", "connectionString", "providerName");

            section.ConnectionStrings.Add(connectionString1);
            ConnectionStringSettings connectionString2 = new ConnectionStringSettings("cs2", "connectionString", "providerName");

            section.ConnectionStrings.Add(connectionString2);

            MockRegistryKey machineConnectionString1Key = new MockRegistryKey(false);

            machineKey.AddSubKey("cs1", machineConnectionString1Key);
            machineConnectionString1Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);
            MockRegistryKey machineConnectionString2Key = new MockRegistryKey(false);

            machineKey.AddSubKey("cs2", machineConnectionString2Key);
            machineConnectionString2Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, true);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(section, false, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(2, section.ConnectionStrings.Count);
            Assert.IsNotNull(section.ConnectionStrings["cs1"]);
            Assert.IsNotNull(section.ConnectionStrings["cs2"]);

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineConnectionString1Key, machineConnectionString2Key));
        }
Beispiel #13
0
        public void UnknownCacheManagerWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            MockCacheManagerData data1 = new MockCacheManagerData();

            data1.Name = "cache manager 1";
            data1.Type = typeof(object);
            section.CacheManagers.Add(data1);
            MockCacheManagerData data2 = new MockCacheManagerData();

            data2.Name = "cache manager 2";
            data2.Type = typeof(object);
            section.CacheManagers.Add(data2);

            MockRegistryKey machineCacheManagersKey = new MockRegistryKey(false);

            machineKey.AddSubKey(CacheManagerSettingsManageabilityProvider.CacheManagersKeyName, machineCacheManagersKey);
            MockRegistryKey machineCacheManager1Key = new MockRegistryKey(false);

            machineCacheManagersKey.AddSubKey("cache manager 1", machineCacheManager1Key);
            machineCacheManager1Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.CacheManagers.Count);
            Assert.IsNotNull(section.CacheManagers.Get("cache manager 1"));
            Assert.IsNotNull(section.CacheManagers.Get("cache manager 2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineCacheManagersKey, machineCacheManager1Key));
        }
        public void ProviderMappingWithDisabledPolicyIsRemoved()
        {
            DbProviderMapping providerMapping1 = new DbProviderMapping("provider1", typeof(SqlDatabase));

            section.ProviderMappings.Add(providerMapping1);
            DbProviderMapping providerMapping2 = new DbProviderMapping("provider2", typeof(SqlDatabase));

            section.ProviderMappings.Add(providerMapping2);

            MockRegistryKey providerMappingsMachineKey = new MockRegistryKey(false);

            machineKey.AddSubKey(DatabaseSettingsManageabilityProvider.ProviderMappingsKeyName,
                                 providerMappingsMachineKey);
            MockRegistryKey providerMapping1MachineKey = new MockRegistryKey(false);

            providerMappingsMachineKey.AddSubKey("provider1",
                                                 providerMapping1MachineKey);
            providerMapping1MachineKey.AddBooleanValue(DatabaseSettingsManageabilityProvider.PolicyValueName, false);
            MockRegistryKey providerMapping2MachineKey = new MockRegistryKey(false);

            providerMappingsMachineKey.AddSubKey("provider2",
                                                 providerMapping2MachineKey);
            providerMapping2MachineKey.AddBooleanValue(DatabaseSettingsManageabilityProvider.PolicyValueName, true);
            providerMapping2MachineKey.AddStringValue(DatabaseSettingsManageabilityProvider.DatabaseTypePropertyName,
                                                      typeof(GenericDatabase).AssemblyQualifiedName);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(1, section.ProviderMappings.Count);
            Assert.IsNotNull(section.ProviderMappings.Get("provider2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(providerMapping1MachineKey, providerMapping2MachineKey, providerMappingsMachineKey));
        }
        public void ProviderMappingWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            DbProviderMapping providerMapping1 = new DbProviderMapping("provider1", typeof(SqlDatabase));

            section.ProviderMappings.Add(providerMapping1);
            DbProviderMapping providerMapping2 = new DbProviderMapping("provider2", typeof(SqlDatabase));

            section.ProviderMappings.Add(providerMapping2);

            MockRegistryKey providerMappingsMachineKey = new MockRegistryKey(false);

            machineKey.AddSubKey(DatabaseSettingsManageabilityProvider.ProviderMappingsKeyName,
                                 providerMappingsMachineKey);
            MockRegistryKey providerMapping1MachineKey = new MockRegistryKey(false);

            providerMappingsMachineKey.AddSubKey("provider1",
                                                 providerMapping1MachineKey);
            providerMapping1MachineKey.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);
            MockRegistryKey providerMapping2MachineKey = new MockRegistryKey(false);

            providerMappingsMachineKey.AddSubKey("provider2",
                                                 providerMapping2MachineKey);
            providerMapping2MachineKey.AddBooleanValue(AdmContentBuilder.AvailableValueName, true);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(section, false, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(2, section.ProviderMappings.Count);
            Assert.IsNotNull(section.ProviderMappings.Get("provider1"));
            Assert.IsNotNull(section.ProviderMappings.Get("provider2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(providerMapping1MachineKey, providerMapping2MachineKey, providerMappingsMachineKey));
        }
Beispiel #16
0
        public void SymmetricCryptoProviderWithDisabledPolicyIsRemoved()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary <Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary <Type, ConfigurationElementManageabilityProvider>();

            subProviders.Add(typeof(SymmetricAlgorithmProviderData), registeredProvider);
            provider = new ConfigurationSectionManageabilityProviderWrapper(
                new CryptographySettingsManageabilityProvider(subProviders));

            SymmetricAlgorithmProviderData symmetricCryptoProvider1Data
                = new SymmetricAlgorithmProviderData("symmetricCryptoProvider1", typeof(Object), "key", DataProtectionScope.CurrentUser);

            section.SymmetricCryptoProviders.Add(symmetricCryptoProvider1Data);
            SymmetricAlgorithmProviderData symmetricCryptoProvider2Data
                = new SymmetricAlgorithmProviderData("symmetricCryptoProvider2", typeof(Object), "key", DataProtectionScope.CurrentUser);

            section.SymmetricCryptoProviders.Add(symmetricCryptoProvider2Data);

            MockRegistryKey machineSymmetricCryptoProvidersKey = new MockRegistryKey(false);

            machineKey.AddSubKey(CryptographySettingsManageabilityProvider.SymmetricCryptoProvidersKeyName, machineSymmetricCryptoProvidersKey);
            MockRegistryKey machineSymmetricCryptoProvider2Key = new MockRegistryKey(false);

            machineSymmetricCryptoProvidersKey.AddSubKey("symmetricCryptoProvider2", machineSymmetricCryptoProvider2Key);
            machineSymmetricCryptoProvider2Key.AddBooleanValue(CryptographySettingsManageabilityProvider.PolicyValueName, false);

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(1, section.SymmetricCryptoProviders.Count);
            Assert.IsNotNull(section.SymmetricCryptoProviders.Get("symmetricCryptoProvider1"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineSymmetricCryptoProvidersKey, machineSymmetricCryptoProvider2Key));
        }
Beispiel #17
0
        public void ConfigurationObjectIsModifiedIfThereAreMachinePolicyOverrides()
        {
            configurationObject.SaltEnabled                 = true;
            configurationObject.AlgorithmType               = typeof(HMACSHA256);
            configurationObject.ProtectedKeyFilename        = "file name";
            configurationObject.ProtectedKeyProtectionScope = DataProtectionScope.CurrentUser;

            machineKey.AddBooleanValue(KeyedHashAlgorithmProviderDataManageabilityProvider.SaltEnabledPropertyName, false);
            machineKey.AddStringValue(KeyedHashAlgorithmProviderDataManageabilityProvider.ProtectedKeyFilenamePropertyName, "machine file name");
            machineKey.AddStringValue(KeyedHashAlgorithmProviderDataManageabilityProvider.ProtectedKeyProtectionScopePropertyName, DataProtectionScope.LocalMachine.ToString());

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(configurationObject, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(false, configurationObject.SaltEnabled);
            Assert.AreEqual("machine file name", configurationObject.ProtectedKeyFilename);
            Assert.AreEqual(DataProtectionScope.LocalMachine, configurationObject.ProtectedKeyProtectionScope);
        }
Beispiel #18
0
        public void ConfigurationObjectIsModifiedIfThereAreUserPolicyOverrides()
        {
            configurationObject.Enabled = false;

            userKey.AddBooleanValue(LogEnabledFilterDataManageabilityProvider.EnabledPropertyName, true);

            provider.OverrideWithGroupPolicies(configurationObject, true, null, userKey);

            Assert.AreEqual(true, configurationObject.Enabled);
        }
Beispiel #19
0
        public void ConfigurationObjectIsModifiedIfThereAreUserPolicyOverrides()
        {
            configurationObject.Formatter          = "formatter";
            configurationObject.MessagePriority    = MessagePriority.Normal;
            configurationObject.QueuePath          = "queue";
            configurationObject.Recoverable        = true;
            configurationObject.TimeToBeReceived   = TimeSpan.MaxValue;
            configurationObject.TimeToReachQueue   = TimeSpan.MinValue;
            configurationObject.TraceOutputOptions = TraceOptions.None;
            configurationObject.Filter             = SourceLevels.Error;
            configurationObject.TransactionType    = MessageQueueTransactionType.None;
            configurationObject.UseAuthentication  = false;
            configurationObject.UseDeadLetterQueue = true;
            configurationObject.UseEncryption      = false;

            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.FormatterPropertyName, "overriden formatter");
            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.MessagePriorityPropertyName, MessagePriority.High.ToString());
            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.QueuePathPropertyName, "overriden queue");
            userKey.AddBooleanValue(MsmqTraceListenerDataManageabilityProvider.RecoverablePropertyName, false);
            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.TimeToBeReceivedPropertyName, Convert.ToString(TimeSpan.FromSeconds(100), CultureInfo.CurrentCulture));
            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.TimeToReachQueuePropertyName, Convert.ToString(TimeSpan.FromSeconds(200), CultureInfo.CurrentCulture));
            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.TraceOutputOptionsPropertyName, "ProcessId, ThreadId");
            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.FilterPropertyName, "Critical");
            userKey.AddStringValue(MsmqTraceListenerDataManageabilityProvider.TransactionTypePropertyName, MessageQueueTransactionType.Single.ToString());
            userKey.AddBooleanValue(MsmqTraceListenerDataManageabilityProvider.UseAuthenticationPropertyName, true);
            userKey.AddBooleanValue(MsmqTraceListenerDataManageabilityProvider.UseDeadLetterQueuePropertyName, false);
            userKey.AddBooleanValue(MsmqTraceListenerDataManageabilityProvider.UseEncryptionPropertyName, true);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(configurationObject, true, null, userKey, true, wmiSettings);

            Assert.AreEqual("overriden formatter", configurationObject.Formatter);
            Assert.AreEqual(MessagePriority.High, configurationObject.MessagePriority);
            Assert.AreEqual("overriden queue", configurationObject.QueuePath);
            Assert.AreEqual(false, configurationObject.Recoverable);
            Assert.AreEqual(TimeSpan.FromSeconds(100), configurationObject.TimeToBeReceived);
            Assert.AreEqual(TimeSpan.FromSeconds(200), configurationObject.TimeToReachQueue);
            Assert.AreEqual(TraceOptions.ProcessId | TraceOptions.ThreadId, configurationObject.TraceOutputOptions);
            Assert.AreEqual(SourceLevels.Critical, configurationObject.Filter);
            Assert.AreEqual(MessageQueueTransactionType.Single, configurationObject.TransactionType);
            Assert.AreEqual(true, configurationObject.UseAuthentication);
            Assert.AreEqual(false, configurationObject.UseDeadLetterQueue);
            Assert.AreEqual(true, configurationObject.UseEncryption);
        }
Beispiel #20
0
        public void SectionPropertiesAreOverridenFromUserKey()
        {
            section.DefaultCacheManager = "default";

            userKey.AddBooleanValue(CacheManagerSettingsManageabilityProvider.PolicyValueName, true);
            userKey.AddStringValue(CacheManagerSettingsManageabilityProvider.DefaultCacheManagerPropertyName, "userOverridenDefault");

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual("userOverridenDefault", section.DefaultCacheManager);
        }
Beispiel #21
0
        public void ConfigurationObjectIsModifiedIfThereAreUserPolicyOverrides()
        {
            configurationObject.SaltEnabled   = true;
            configurationObject.AlgorithmType = typeof(SHA1Managed);

            userKey.AddBooleanValue(HashAlgorithmProviderDataManageabilityProvider.SaltEnabledPropertyName, false);

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(configurationObject, true, null, userKey, true, wmiSettings);

            Assert.AreEqual(false, configurationObject.SaltEnabled);
        }
Beispiel #22
0
        public void UpdateOnSectionReappliesPoliciesAndRepublishesWmiObjects()
        {
            TestsConfigurationSection section = new TestsConfigurationSection(originalValue);

            configurationSource.Add(SectionName, section);

            MockRegistryKey userKey = new MockRegistryKey(false);

            currentUser.AddSubKey(ManageabilityHelper.BuildSectionKeyName(ApplicationName, SectionName), userKey);
            userKey.AddBooleanValue(RegistryKeyBase.PolicyValueName, true);
            userKey.AddStringValue(MockConfigurationSectionManageabilityProvider.ValuePropertyName, "Overriden");
            MockRegistryKey machineKey = new MockRegistryKey(false);

            localMachine.AddSubKey(ManageabilityHelper.BuildSectionKeyName(ApplicationName, SectionName), machineKey);

            MockConfigurationSectionManageabilityProvider manageabilityProvider = new MockConfigurationSectionManageabilityProvider(subProviders);

            manageabilityProviders.Add(SectionName, manageabilityProvider);

            ManageabilityHelper helper
                = new ManageabilityHelper(manageabilityProviders, true, registryAccessor, true, wmiPublisher, ApplicationName);

            helper.ConfigurationSettingChanged += OnConfigurationSettingChangedTriggerUpdate;
            helper.UpdateConfigurationManageability(configurationAccessor);

            // check the original setting was published alright.
            IEnumerator <ConfigurationSetting> publishedInstances = wmiPublisher.GetPublishedInstances().GetEnumerator();

            Assert.IsTrue(publishedInstances.MoveNext());
            TestConfigurationSettings originalSetting = publishedInstances.Current as TestConfigurationSettings;

            Assert.IsNotNull(originalSetting);
            Assert.AreEqual("Overriden", originalSetting.Value);
            Assert.IsFalse(publishedInstances.MoveNext());

            // change and notify
            originalSetting.Value = "Foo";
            originalSetting.Commit();

            // check the updated setting is indeed updated and a new instance
            // the gp override should still take precedence
            publishedInstances = wmiPublisher.GetPublishedInstances().GetEnumerator();
            Assert.IsTrue(publishedInstances.MoveNext());
            TestConfigurationSettings updatedSetting = publishedInstances.Current as TestConfigurationSettings;

            Assert.IsNotNull(updatedSetting);
            Assert.AreNotSame(originalSetting, updatedSetting);
            Assert.AreEqual("Overriden", updatedSetting.Value);
            Assert.IsFalse(publishedInstances.MoveNext());
        }
        public void SectionPropertiesAreOverridenFromUserKey()
        {
            section.DefaultHashProviderName            = "default hash";
            section.DefaultSymmetricCryptoProviderName = "default symmetric";

            userKey.AddBooleanValue(CryptographySettingsManageabilityProvider.PolicyValueName, true);
            userKey.AddStringValue(CryptographySettingsManageabilityProvider.DefaultHashProviderPropertyName, "user hash");
            userKey.AddStringValue(CryptographySettingsManageabilityProvider.DefaultSymmetricCryptoProviderPropertyName, "user symmetric");

            provider.OverrideWithGroupPolicies(section, true, userKey, userKey);

            Assert.AreEqual("user hash", section.DefaultHashProviderName);
            Assert.AreEqual("user symmetric", section.DefaultSymmetricCryptoProviderName);
        }
Beispiel #24
0
        public void SectionPropertiesAreOverridenFromMachineKey()
        {
            section.DefaultAuthorizationProviderName = "default authorization";
            section.DefaultSecurityCacheProviderName = "default securitycache";

            machineKey.AddBooleanValue(SecuritySettingsManageabilityProvider.PolicyValueName, true);
            machineKey.AddStringValue(SecuritySettingsManageabilityProvider.DefaultAuthorizationProviderPropertyName, "machine authorization");
            machineKey.AddStringValue(SecuritySettingsManageabilityProvider.DefaultSecurityCacheProviderPropertyName, "machine securitycache");

            provider.InvokeOverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual("machine authorization", section.DefaultAuthorizationProviderName);
            Assert.AreEqual("machine securitycache", section.DefaultSecurityCacheProviderName);
        }
Beispiel #25
0
        public void MachinePolicyOverrideTakesPrecedenceOverUserPolicyOverride()
        {
            section.EventLoggingEnabled        = true;
            section.PerformanceCountersEnabled = true;
            section.WmiEnabled = true;

            machineKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.PolicyValueName, true);
            machineKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.EventLoggingEnabledPropertyName, false);
            machineKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.PerformanceCountersEnabledPropertyName, true);
            machineKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.WmiEnabledPropertyName, false);
            userKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.PolicyValueName, true);
            userKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.EventLoggingEnabledPropertyName, true);
            userKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.PerformanceCountersEnabledPropertyName, false);
            userKey.AddBooleanValue(InstrumentationConfigurationSectionManageabilityProvider.WmiEnabledPropertyName, true);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(section, true, machineKey, userKey, false, wmiSettings);

            Assert.AreEqual(false, section.EventLoggingEnabled);
            Assert.AreEqual(true, section.PerformanceCountersEnabled);
            Assert.AreEqual(false, section.WmiEnabled);
        }
Beispiel #26
0
        public void MachineKeyOverridesTakePrecedenceOverUserKeyOverrides()
        {
            configurationObject.CategoryFilterMode = CategoryFilterMode.AllowAllExceptDenied;
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat1"));
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat2"));

            machineKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.DenyAllExceptAllowed.ToString());
            userKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.AllowAllExceptDenied.ToString());
            MockRegistryKey userCategoriesKey = new MockRegistryKey(false);

            userKey.AddSubKey(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName, userCategoriesKey);
            userCategoriesKey.AddBooleanValue("cat3", true);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(configurationObject, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(CategoryFilterMode.DenyAllExceptAllowed, configurationObject.CategoryFilterMode);
            Assert.AreEqual(0, configurationObject.CategoryFilters.Count);

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(userCategoriesKey));
        }
Beispiel #27
0
        public void ConfigurationObjectIsModifiedIfThereAreUserPolicyOverrides()
        {
            configurationObject.CategoryFilterMode = CategoryFilterMode.AllowAllExceptDenied;
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat1"));
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat2"));

            userKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.DenyAllExceptAllowed.ToString());
            MockRegistryKey userCategoriesKey = new MockRegistryKey(false);

            userKey.AddSubKey(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName, userCategoriesKey);
            userCategoriesKey.AddBooleanValue("cat3", true);

            provider.OverrideWithGroupPolicies(configurationObject, true, null, userKey);

            Assert.AreEqual(CategoryFilterMode.DenyAllExceptAllowed, configurationObject.CategoryFilterMode);
            Assert.AreEqual(1, configurationObject.CategoryFilters.Count);
            Assert.IsNotNull(configurationObject.CategoryFilters.Get("cat3"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(userCategoriesKey));
        }
Beispiel #28
0
        public void ConfigurationObjectIsNotModifiedIfThereArePolicyOverridesButGroupPoliciesAreDisabled()
        {
            configurationObject.CategoryFilterMode = CategoryFilterMode.AllowAllExceptDenied;
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat1"));
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat2"));

            machineKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.DenyAllExceptAllowed.ToString());
            MockRegistryKey machineCategoriesKey = new MockRegistryKey(false);

            machineKey.AddSubKey(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName, machineCategoriesKey);
            machineCategoriesKey.AddBooleanValue("cat3", true);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(configurationObject, false, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(CategoryFilterMode.AllowAllExceptDenied, configurationObject.CategoryFilterMode);
            Assert.AreEqual(2, configurationObject.CategoryFilters.Count);
            Assert.IsNotNull(configurationObject.CategoryFilters.Get("cat1"));
            Assert.IsNotNull(configurationObject.CategoryFilters.Get("cat2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineCategoriesKey));
        }
Beispiel #29
0
        public void WmiSettingsAreGeneratedWithPolicyOverridesIfWmiIsEnabled()
        {
            configurationObject.CategoryFilterMode = CategoryFilterMode.AllowAllExceptDenied;
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat1"));
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat2"));

            machineKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.DenyAllExceptAllowed.ToString());
            MockRegistryKey machineCategoriesKey = new MockRegistryKey(false);

            machineKey.AddSubKey(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName, machineCategoriesKey);
            machineCategoriesKey.AddBooleanValue("cat3", true);

            provider.OverrideWithGroupPoliciesAndGenerateWmiObjects(configurationObject, true, machineKey, userKey, true, wmiSettings);

            Assert.AreEqual(1, wmiSettings.Count);
            Assert.AreSame(typeof(CategoryFilterSetting), wmiSettings[0].GetType());
            Assert.AreEqual(configurationObject.CategoryFilterMode.ToString(), ((CategoryFilterSetting)wmiSettings[0]).CategoryFilterMode);
            Assert.AreEqual(configurationObject.CategoryFilters.Count, ((CategoryFilterSetting)wmiSettings[0]).CategoryFilters.Length);
            foreach (String name in ((CategoryFilterSetting)wmiSettings[0]).CategoryFilters)
            {
                Assert.IsNotNull(configurationObject.CategoryFilters.Get(name));
            }
        }
        public void WillNotRemoveRegisteredSectionWithDisabledPolicyIfPolicyOverridesAreDisabled()
        {
            TestsConfigurationSection section = new TestsConfigurationSection(originalValue);

            configurationSource.Add(SectionName, section);

            MockRegistryKey machineKey = new MockRegistryKey(false);

            localMachine.AddSubKey(ManageabilityHelper.BuildSectionKeyName(ApplicationName, SectionName), machineKey);
            machineKey.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            MockConfigurationSectionManageabilityProvider manageabilityProvider
                = new MockConfigurationSectionManageabilityProvider(subProviders);

            manageabilityProviders.Add(SectionName, manageabilityProvider);
            ManageabilityHelper helper
                = new ManageabilityHelper(manageabilityProviders, false, registryAccessor, ApplicationName);

            Assert.IsTrue(configurationSource.Contains(SectionName));

            helper.UpdateConfigurationManageability(configurationAccessor);

            Assert.IsTrue(configurationSource.Contains(SectionName));
        }
        public void SecurityCacheProviderWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary<Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary<Type, ConfigurationElementManageabilityProvider>();
            subProviders.Add(typeof(SecurityCacheProviderData), registeredProvider);
            provider = new SecuritySettingsManageabilityProvider(subProviders);

            SecurityCacheProviderData securityCacheProvider1Data = new SecurityCacheProviderData("securityCacheProvider1", typeof(Object));
            section.SecurityCacheProviders.Add(securityCacheProvider1Data);
            SecurityCacheProviderData securityCacheProvider2Data = new SecurityCacheProviderData("securityCacheProvider2", typeof(Object));
            section.SecurityCacheProviders.Add(securityCacheProvider2Data);

            MockRegistryKey machineSecurityCacheProvidersKey = new MockRegistryKey(false);
            machineKey.AddSubKey(SecuritySettingsManageabilityProvider.SecurityCacheProvidersKeyName, machineSecurityCacheProvidersKey);
            MockRegistryKey machineSecurityCacheProvider2Key = new MockRegistryKey(false);
            machineSecurityCacheProvidersKey.AddSubKey("securityCacheProvider2", machineSecurityCacheProvider2Key);
            machineSecurityCacheProvider2Key.AddBooleanValue(SecuritySettingsManageabilityProvider.PolicyValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.SecurityCacheProviders.Count);
            Assert.IsNotNull(section.SecurityCacheProviders.Get("securityCacheProvider1"));
            Assert.IsNotNull(section.SecurityCacheProviders.Get("securityCacheProvider2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineSecurityCacheProvidersKey, machineSecurityCacheProvider2Key));
        }
        public void TraceSourceTraceListenersAreOverridenIfListenerKeyIsPresentInUserKey()
        {
            TraceSourceData sourceData = new TraceSourceData("source1", SourceLevels.Critical, true);
            section.TraceSources.Add(sourceData);
            sourceData.TraceListeners.Add(new TraceListenerReferenceData("listener1"));
            sourceData.TraceListeners.Add(new TraceListenerReferenceData("listener2"));

            MockRegistryKey userTraceSourcesKey = new MockRegistryKey(false);
            userKey.AddSubKey(LoggingSettingsManageabilityProvider.CategorySourcesKeyName, userTraceSourcesKey);
            MockRegistryKey userSource1Key = new MockRegistryKey(false);
            userTraceSourcesKey.AddSubKey("source1", userSource1Key);
            userSource1Key.AddEnumValue<SourceLevels>(LoggingSettingsManageabilityProvider.SourceDefaultLevelPropertyName, SourceLevels.ActivityTracing);
            userSource1Key.AddBooleanValue(LoggingSettingsManageabilityProvider.SourceAutoFlushPropertyName, false);
            MockRegistryKey userSource1ListenersKey = new MockRegistryKey(false);
            userSource1Key.AddSubKey(LoggingSettingsManageabilityProvider.SourceTraceListenersPropertyName, userSource1ListenersKey);
            userSource1ListenersKey.AddBooleanValue("listener3", true);
            userSource1ListenersKey.AddBooleanValue("listener4", true);
            userSource1ListenersKey.AddBooleanValue("listener5", true);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(3, sourceData.TraceListeners.Count);
            Assert.IsNotNull(sourceData.TraceListeners.Get("listener3"));
            Assert.IsNotNull(sourceData.TraceListeners.Get("listener4"));
            Assert.IsNotNull(sourceData.TraceListeners.Get("listener5"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(userTraceSourcesKey, userSource1Key, userSource1ListenersKey));
        }
        public void TraceSourceDefaultLevelIsOverridenFromUserKey()
        {
            TraceSourceData sourceData = new TraceSourceData("source1", SourceLevels.Critical, true);
            section.TraceSources.Add(sourceData);

            MockRegistryKey userTraceSourcesKey = new MockRegistryKey(false);
            userKey.AddSubKey(LoggingSettingsManageabilityProvider.CategorySourcesKeyName, userTraceSourcesKey);
            MockRegistryKey userSource1Key = new MockRegistryKey(false);
            userTraceSourcesKey.AddSubKey("source1", userSource1Key);
            userSource1Key.AddStringValue(LoggingSettingsManageabilityProvider.SourceDefaultLevelPropertyName, SourceLevels.Error.ToString());
            userSource1Key.AddBooleanValue(LoggingSettingsManageabilityProvider.SourceAutoFlushPropertyName, false);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(SourceLevels.Error, sourceData.DefaultLevel);
            Assert.AreEqual(false, sourceData.AutoFlush);

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(userTraceSourcesKey, userSource1Key));
        }
        public void MachineOverridesTakePrecedenceOverUserOverrides()
        {
            section.SpecialTraceSources.AllEventsTraceSource.DefaultLevel = SourceLevels.Critical;
            section.SpecialTraceSources.ErrorsTraceSource.DefaultLevel = SourceLevels.Critical;
            section.SpecialTraceSources.NotProcessedTraceSource.DefaultLevel = SourceLevels.Critical;
            section.SpecialTraceSources.AllEventsTraceSource.AutoFlush = true;
            section.SpecialTraceSources.ErrorsTraceSource.AutoFlush = true;
            section.SpecialTraceSources.NotProcessedTraceSource.AutoFlush = true;

            MockRegistryKey userSpecialSourcesKey = new MockRegistryKey(false);
            userKey.AddSubKey(LoggingSettingsManageabilityProvider.SpecialSourcesKeyName, userSpecialSourcesKey);
            MockRegistryKey userAllEventsSourceKey = new MockRegistryKey(false);
            userSpecialSourcesKey.AddSubKey(LoggingSettingsManageabilityProvider.SpecialSourcesAllEventsKeyName, userAllEventsSourceKey);
            userAllEventsSourceKey.AddStringValue(LoggingSettingsManageabilityProvider.SourceDefaultLevelPropertyName, SourceLevels.Error.ToString());
            userAllEventsSourceKey.AddBooleanValue(LoggingSettingsManageabilityProvider.SourceAutoFlushPropertyName, false);
            MockRegistryKey userErrorsSourceKey = new MockRegistryKey(false);
            userSpecialSourcesKey.AddSubKey(LoggingSettingsManageabilityProvider.SpecialSourcesErrorsKeyName, userErrorsSourceKey);
            userErrorsSourceKey.AddStringValue(LoggingSettingsManageabilityProvider.SourceDefaultLevelPropertyName, SourceLevels.Information.ToString());
            userErrorsSourceKey.AddBooleanValue(LoggingSettingsManageabilityProvider.SourceAutoFlushPropertyName, false);
            MockRegistryKey userNotProcessedSourceKey = new MockRegistryKey(false);
            userSpecialSourcesKey.AddSubKey(LoggingSettingsManageabilityProvider.SpecialSourcesNotProcessedKeyName, userNotProcessedSourceKey);
            userNotProcessedSourceKey.AddStringValue(LoggingSettingsManageabilityProvider.SourceDefaultLevelPropertyName, SourceLevels.Warning.ToString());
            userNotProcessedSourceKey.AddBooleanValue(LoggingSettingsManageabilityProvider.SourceAutoFlushPropertyName, false);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(SourceLevels.Error, section.SpecialTraceSources.AllEventsTraceSource.DefaultLevel);
            Assert.AreEqual(SourceLevels.Information, section.SpecialTraceSources.ErrorsTraceSource.DefaultLevel);
            Assert.AreEqual(SourceLevels.Warning, section.SpecialTraceSources.NotProcessedTraceSource.DefaultLevel);
            Assert.AreEqual(false, section.SpecialTraceSources.AllEventsTraceSource.AutoFlush);
            Assert.AreEqual(false, section.SpecialTraceSources.ErrorsTraceSource.AutoFlush);
            Assert.AreEqual(false, section.SpecialTraceSources.NotProcessedTraceSource.AutoFlush);

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(userSpecialSourcesKey,
                                                         userAllEventsSourceKey, userErrorsSourceKey, userNotProcessedSourceKey));
        }
        public void MachineKeySourceOverrideWithoutListenersSubKeyTakesPrecedenceOverUserKeyOverrides()
        {
            TraceSourceData sourceData = new TraceSourceData("source1", SourceLevels.Critical, true);
            section.TraceSources.Add(sourceData);
            sourceData.TraceListeners.Add(new TraceListenerReferenceData("listener1"));
            sourceData.TraceListeners.Add(new TraceListenerReferenceData("listener2"));

            MockRegistryKey machineTraceSourcesKey = new MockRegistryKey(false);
            machineKey.AddSubKey(LoggingSettingsManageabilityProvider.CategorySourcesKeyName, machineTraceSourcesKey);
            MockRegistryKey machineSource1Key = new MockRegistryKey(false);
            machineTraceSourcesKey.AddSubKey("source1", machineSource1Key);
            machineSource1Key.AddEnumValue<SourceLevels>(LoggingSettingsManageabilityProvider.SourceDefaultLevelPropertyName, SourceLevels.ActivityTracing);
            machineSource1Key.AddBooleanValue(LoggingSettingsManageabilityProvider.SourceAutoFlushPropertyName, false);
            MockRegistryKey userTraceSourcesKey = new MockRegistryKey(false);
            userKey.AddSubKey(LoggingSettingsManageabilityProvider.CategorySourcesKeyName, userTraceSourcesKey);
            MockRegistryKey userSource1Key = new MockRegistryKey(false);
            userTraceSourcesKey.AddSubKey("source1", userSource1Key);
            userSource1Key.AddEnumValue<SourceLevels>(LoggingSettingsManageabilityProvider.SourceDefaultLevelPropertyName, SourceLevels.ActivityTracing);
            userSource1Key.AddBooleanValue(LoggingSettingsManageabilityProvider.SourceAutoFlushPropertyName, false);
            MockRegistryKey userSource1ListenersKey = new MockRegistryKey(false);
            userSource1Key.AddSubKey(LoggingSettingsManageabilityProvider.SourceTraceListenersPropertyName, userSource1ListenersKey);
            userSource1ListenersKey.AddBooleanValue("listener6", true);
            userSource1ListenersKey.AddBooleanValue("listener7", true);
            userSource1ListenersKey.AddBooleanValue("listener8", true);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(0, sourceData.TraceListeners.Count);

            Assert.IsTrue(
                MockRegistryKey.CheckAllClosed(
                    machineTraceSourcesKey, machineSource1Key,
                    userTraceSourcesKey, userSource1Key, userSource1ListenersKey));
        }
        public void MachineKeyOverridesTakePrecedenceOverUserKeyOverrides()
        {
            configurationObject.CategoryFilterMode = CategoryFilterMode.AllowAllExceptDenied;
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat1"));
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat2"));

            machineKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.DenyAllExceptAllowed.ToString());
            userKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.AllowAllExceptDenied.ToString());
            MockRegistryKey userCategoriesKey = new MockRegistryKey(false);
            userKey.AddSubKey(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName, userCategoriesKey);
            userCategoriesKey.AddBooleanValue("cat3", true);

            provider.OverrideWithGroupPolicies(configurationObject, true, machineKey, userKey);

            Assert.AreEqual(CategoryFilterMode.DenyAllExceptAllowed, configurationObject.CategoryFilterMode);
            Assert.AreEqual(0, configurationObject.CategoryFilters.Count);

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(userCategoriesKey));
        }
        public void ProviderMappingWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            DbProviderMapping providerMapping1 = new DbProviderMapping("provider1", typeof(SqlDatabase));
            section.ProviderMappings.Add(providerMapping1);
            DbProviderMapping providerMapping2 = new DbProviderMapping("provider2", typeof(SqlDatabase));
            section.ProviderMappings.Add(providerMapping2);

            MockRegistryKey providerMappingsMachineKey = new MockRegistryKey(false);
            machineKey.AddSubKey(DatabaseSettingsManageabilityProvider.ProviderMappingsKeyName,
                                 providerMappingsMachineKey);
            MockRegistryKey providerMapping1MachineKey = new MockRegistryKey(false);
            providerMappingsMachineKey.AddSubKey("provider1",
                                                 providerMapping1MachineKey);
            providerMapping1MachineKey.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);
            MockRegistryKey providerMapping2MachineKey = new MockRegistryKey(false);
            providerMappingsMachineKey.AddSubKey("provider2",
                                                 providerMapping2MachineKey);
            providerMapping2MachineKey.AddBooleanValue(AdmContentBuilder.AvailableValueName, true);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.ProviderMappings.Count);
            Assert.IsNotNull(section.ProviderMappings.Get("provider1"));
            Assert.IsNotNull(section.ProviderMappings.Get("provider2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(providerMapping1MachineKey, providerMapping2MachineKey, providerMappingsMachineKey));
        }
        public void SpecialTraceSourceWithDisabledPolicyIsNotInvalidatedIfGroupPoliciesAreDisabled()
        {
            section.SpecialTraceSources.AllEventsTraceSource.TraceListeners.Add(new TraceListenerReferenceData("listener"));

            MockRegistryKey machineTraceSpecialSourcesKey = new MockRegistryKey(false);
            machineKey.AddSubKey(LoggingSettingsManageabilityProvider.SpecialSourcesKeyName, machineTraceSpecialSourcesKey);
            MockRegistryKey machineAllEventsTraceSourceKey = new MockRegistryKey(false);
            machineTraceSpecialSourcesKey.AddSubKey(LoggingSettingsManageabilityProvider.SpecialSourcesAllEventsKeyName, machineAllEventsTraceSourceKey);
            machineAllEventsTraceSourceKey.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(1, section.SpecialTraceSources.AllEventsTraceSource.TraceListeners.Count);
            Assert.IsNotNull(section.SpecialTraceSources.AllEventsTraceSource.TraceListeners.Get("listener"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineTraceSpecialSourcesKey, machineAllEventsTraceSourceKey));
        }
        public void TraceSourceWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            TraceSourceData traceSource1Data = new TraceSourceData("traceSource1", SourceLevels.Error);
            section.TraceSources.Add(traceSource1Data);
            TraceSourceData traceSource2Data = new TraceSourceData("traceSource2", SourceLevels.Error);
            section.TraceSources.Add(traceSource2Data);

            MockRegistryKey machineTraceSourcesKey = new MockRegistryKey(false);
            machineKey.AddSubKey(LoggingSettingsManageabilityProvider.CategorySourcesKeyName, machineTraceSourcesKey);
            MockRegistryKey machineTraceSource2Key = new MockRegistryKey(false);
            machineTraceSourcesKey.AddSubKey("traceSource2", machineTraceSource2Key);
            machineTraceSource2Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.TraceSources.Count);
            Assert.IsNotNull(section.TraceSources.Get("traceSource1"));
            Assert.IsNotNull(section.TraceSources.Get("traceSource2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineTraceSourcesKey, machineTraceSource2Key));
        }
        public void WillNotRemoveRegisteredSectionWithDisabledPolicyIfPolicyOverridesAreDisabled()
        {
            TestsConfigurationSection section = new TestsConfigurationSection(originalValue);
            configurationSource.Add(SectionName, section);

            MockRegistryKey machineKey = new MockRegistryKey(false);
            localMachine.AddSubKey(ManageabilityHelper.BuildSectionKeyName(ApplicationName, SectionName), machineKey);
            machineKey.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            MockConfigurationSectionManageabilityProvider manageabilityProvider
                = new MockConfigurationSectionManageabilityProvider(subProviders);
            manageabilityProviders.Add(SectionName, manageabilityProvider);
            ManageabilityHelper helper
                = new ManageabilityHelper(manageabilityProviders, false, registryAccessor, ApplicationName);

            Assert.IsTrue(configurationSource.Contains(SectionName));

            helper.UpdateConfigurationManageability(configurationAccessor);

            Assert.IsTrue(configurationSource.Contains(SectionName));
        }
        public void OracleConnectionWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            OracleConnectionData connectionData1 = new OracleConnectionData();
            connectionData1.Name = "data1";
            section.OracleConnectionsData.Add(connectionData1);
            OracleConnectionData connectionData2 = new OracleConnectionData();
            connectionData2.Name = "data2";
            section.OracleConnectionsData.Add(connectionData2);

            MockRegistryKey machinePackage1Key = new MockRegistryKey(false);
            machineKey.AddSubKey("data1", machinePackage1Key);
            machinePackage1Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);
            MockRegistryKey machinePackage2Key = new MockRegistryKey(false);
            machineKey.AddSubKey("data2", machinePackage2Key);
            machinePackage2Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, true);
            machinePackage2Key.AddStringValue(OracleConnectionSettingsManageabilityProvider.PackagesPropertyName,
                                              "package24=prefix24");

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.OracleConnectionsData.Count);
            Assert.IsNotNull(section.OracleConnectionsData.Get("data1"));
            Assert.IsNotNull(section.OracleConnectionsData.Get("data2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machinePackage1Key, machinePackage2Key));
        }
        public void UnknownCacheManagerWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            MockCacheManagerData data1 = new MockCacheManagerData();
            data1.Name = "cache manager 1";
            data1.Type = typeof(object);
            section.CacheManagers.Add(data1);
            MockCacheManagerData data2 = new MockCacheManagerData();
            data2.Name = "cache manager 2";
            data2.Type = typeof(object);
            section.CacheManagers.Add(data2);

            MockRegistryKey machineCacheManagersKey = new MockRegistryKey(false);
            machineKey.AddSubKey(CacheManagerSettingsManageabilityProvider.CacheManagersKeyName, machineCacheManagersKey);
            MockRegistryKey machineCacheManager1Key = new MockRegistryKey(false);
            machineCacheManagersKey.AddSubKey("cache manager 1", machineCacheManager1Key);
            machineCacheManager1Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.CacheManagers.Count);
            Assert.IsNotNull(section.CacheManagers.Get("cache manager 1"));
            Assert.IsNotNull(section.CacheManagers.Get("cache manager 2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineCacheManagersKey, machineCacheManager1Key));
        }
        public void SymmetricCryptoProviderWithDisabledPolicyIsRemoved()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary<Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary<Type, ConfigurationElementManageabilityProvider>();
            subProviders.Add(typeof(SymmetricAlgorithmProviderData), registeredProvider);
            provider = new CryptographySettingsManageabilityProvider(subProviders);

            SymmetricAlgorithmProviderData symmetricCryptoProvider1Data
                = new SymmetricAlgorithmProviderData("symmetricCryptoProvider1", typeof(Object), "key", DataProtectionScope.CurrentUser);
            section.SymmetricCryptoProviders.Add(symmetricCryptoProvider1Data);
            SymmetricAlgorithmProviderData symmetricCryptoProvider2Data
                = new SymmetricAlgorithmProviderData("symmetricCryptoProvider2", typeof(Object), "key", DataProtectionScope.CurrentUser);
            section.SymmetricCryptoProviders.Add(symmetricCryptoProvider2Data);

            MockRegistryKey machineSymmetricCryptoProvidersKey = new MockRegistryKey(false);
            machineKey.AddSubKey(CryptographySettingsManageabilityProvider.SymmetricCryptoProvidersKeyName, machineSymmetricCryptoProvidersKey);
            MockRegistryKey machineSymmetricCryptoProvider2Key = new MockRegistryKey(false);
            machineSymmetricCryptoProvidersKey.AddSubKey("symmetricCryptoProvider2", machineSymmetricCryptoProvider2Key);
            machineSymmetricCryptoProvider2Key.AddBooleanValue(CryptographySettingsManageabilityProvider.PolicyValueName, false);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(1, section.SymmetricCryptoProviders.Count);
            Assert.IsNotNull(section.SymmetricCryptoProviders.Get("symmetricCryptoProvider1"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineSymmetricCryptoProvidersKey, machineSymmetricCryptoProvider2Key));
        }
        public void LogFormatterWithDisabledPolicyIsRemoved()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary<Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary<Type, ConfigurationElementManageabilityProvider>();
            subProviders.Add(typeof(FormatterData), registeredProvider);
            provider = new LoggingSettingsManageabilityProvider(subProviders);

            FormatterData logFormatter1Data = new FormatterData("logFormatter1", typeof(Object));
            section.Formatters.Add(logFormatter1Data);
            FormatterData logFormatter2Data = new FormatterData("logFormatter2", typeof(Object));
            section.Formatters.Add(logFormatter2Data);

            MockRegistryKey machineLogFormattersKey = new MockRegistryKey(false);
            machineKey.AddSubKey(LoggingSettingsManageabilityProvider.LogFormattersKeyName, machineLogFormattersKey);
            MockRegistryKey machineLogFormatter2Key = new MockRegistryKey(false);
            machineLogFormattersKey.AddSubKey("logFormatter2", machineLogFormatter2Key);
            machineLogFormatter2Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(1, section.Formatters.Count);
            Assert.IsNotNull(section.Formatters.Get("logFormatter1"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineLogFormattersKey, machineLogFormatter2Key));
        }
        public void TraceListenerWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            MockConfigurationElementManageabilityProvider registeredProvider
                = new MockConfigurationElementManageabilityProvider();
            Dictionary<Type, ConfigurationElementManageabilityProvider> subProviders
                = new Dictionary<Type, ConfigurationElementManageabilityProvider>();
            subProviders.Add(typeof(TraceListenerData), registeredProvider);
            provider = new LoggingSettingsManageabilityProvider(subProviders);

            TraceListenerData traceListener1Data = new TraceListenerData();
            traceListener1Data.Name = "traceListener1";
            section.TraceListeners.Add(traceListener1Data);
            TraceListenerData traceListener2Data = new TraceListenerData();
            traceListener2Data.Name = "traceListener2";
            section.TraceListeners.Add(traceListener2Data);

            MockRegistryKey machineTraceListenersKey = new MockRegistryKey(false);
            machineKey.AddSubKey(LoggingSettingsManageabilityProvider.TraceListenersKeyName, machineTraceListenersKey);
            MockRegistryKey machineTraceListener2Key = new MockRegistryKey(false);
            machineTraceListenersKey.AddSubKey("traceListener2", machineTraceListener2Key);
            machineTraceListener2Key.AddBooleanValue(AdmContentBuilder.AvailableValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.TraceListeners.Count);
            Assert.IsNotNull(section.TraceListeners.Get("traceListener1"));
            Assert.IsNotNull(section.TraceListeners.Get("traceListener2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineTraceListenersKey, machineTraceListener2Key));
        }
        public void ConfigurationObjectIsNotModifiedIfThereArePolicyOverridesButGroupPoliciesAreDisabled()
        {
            configurationObject.CategoryFilterMode = CategoryFilterMode.AllowAllExceptDenied;
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat1"));
            configurationObject.CategoryFilters.Add(new CategoryFilterEntry("cat2"));

            machineKey.AddStringValue(CategoryFilterDataManageabilityProvider.CategoryFilterModePropertyName, CategoryFilterMode.DenyAllExceptAllowed.ToString());
            MockRegistryKey machineCategoriesKey = new MockRegistryKey(false);
            machineKey.AddSubKey(CategoryFilterDataManageabilityProvider.CategoryFiltersKeyName, machineCategoriesKey);
            machineCategoriesKey.AddBooleanValue("cat3", true);

            provider.OverrideWithGroupPolicies(configurationObject, false, machineKey, userKey);

            Assert.AreEqual(CategoryFilterMode.AllowAllExceptDenied, configurationObject.CategoryFilterMode);
            Assert.AreEqual(2, configurationObject.CategoryFilters.Count);
            Assert.IsNotNull(configurationObject.CategoryFilters.Get("cat1"));
            Assert.IsNotNull(configurationObject.CategoryFilters.Get("cat2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(machineCategoriesKey));
        }
        public void ExceptionTypeWithDisabledPolicyIsNotRemovedIfGroupPoliciesAreDisabled()
        {
            ExceptionPolicyData policy1 = new ExceptionPolicyData("policy1");
            section.ExceptionPolicies.Add(policy1);
            ExceptionTypeData exceptionType11 = new ExceptionTypeData("type11", typeof(Exception), PostHandlingAction.None);
            policy1.ExceptionTypes.Add(exceptionType11);
            ExceptionTypeData exceptionType12 = new ExceptionTypeData("type12", typeof(Exception), PostHandlingAction.None);
            policy1.ExceptionTypes.Add(exceptionType12);
            ExceptionPolicyData policy2 = new ExceptionPolicyData("policy2");
            section.ExceptionPolicies.Add(policy2);
            ExceptionTypeData exceptionType21 = new ExceptionTypeData("type21", typeof(Exception), PostHandlingAction.None);
            policy2.ExceptionTypes.Add(exceptionType21);

            MockRegistryKey userPoliciesKey = new MockRegistryKey(false);
            userKey.AddSubKey(ExceptionHandlingSettingsManageabilityProvider.PoliciesKeyName, userPoliciesKey);
            MockRegistryKey userPolicy1Key = new MockRegistryKey(false);
            userPoliciesKey.AddSubKey("policy1", userPolicy1Key);
            MockRegistryKey userPolicy1TypesKey = new MockRegistryKey(false);
            userPolicy1Key.AddSubKey(ExceptionHandlingSettingsManageabilityProvider.PolicyTypesPropertyName, userPolicy1TypesKey);
            MockRegistryKey userPolicy1Type11Key = new MockRegistryKey(false);
            userPolicy1TypesKey.AddSubKey("type11", userPolicy1Type11Key);
            userPolicy1Type11Key.AddBooleanValue(ExceptionHandlingSettingsManageabilityProvider.PolicyValueName, false);
            MockRegistryKey userPolicy1Type12Key = new MockRegistryKey(false);
            userPolicy1TypesKey.AddSubKey("type12", userPolicy1Type12Key);
            userPolicy1Type12Key.AddBooleanValue(ExceptionHandlingSettingsManageabilityProvider.PolicyValueName, true);
            MockRegistryKey userPolicy2Key = new MockRegistryKey(false);
            userPoliciesKey.AddSubKey("policy2", userPolicy2Key);
            MockRegistryKey userPolicy2TypesKey = new MockRegistryKey(false);
            userPolicy2Key.AddSubKey(ExceptionHandlingSettingsManageabilityProvider.PolicyTypesPropertyName, userPolicy2TypesKey);
            MockRegistryKey userPolicy2Type21Key = new MockRegistryKey(false);
            userPolicy2TypesKey.AddSubKey("type21", userPolicy2Type21Key);
            userPolicy2Type21Key.AddBooleanValue(ExceptionHandlingSettingsManageabilityProvider.PolicyValueName, false);

            provider.OverrideWithGroupPolicies(section, false, machineKey, userKey);

            Assert.AreEqual(2, section.ExceptionPolicies.Count);
            Assert.IsNotNull(section.ExceptionPolicies.Get("policy1"));
            Assert.AreEqual(2, section.ExceptionPolicies.Get("policy1").ExceptionTypes.Count);
            Assert.IsNotNull(section.ExceptionPolicies.Get("policy1").ExceptionTypes.Get("type11"));
            Assert.IsNotNull(section.ExceptionPolicies.Get("policy1").ExceptionTypes.Get("type12"));
            Assert.IsNotNull(section.ExceptionPolicies.Get("policy2"));
            Assert.AreEqual(1, section.ExceptionPolicies.Get("policy2").ExceptionTypes.Count);
            Assert.IsNotNull(section.ExceptionPolicies.Get("policy2").ExceptionTypes.Get("type21"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(userPoliciesKey,
                                                         userPolicy1Key, userPolicy1TypesKey, userPolicy1Type11Key,
                                                         userPolicy1Type12Key,
                                                         userPolicy2Key, userPolicy2TypesKey, userPolicy2Type21Key));
        }
        public void ProviderMappingWithDisabledPolicyIsRemoved()
        {
            DbProviderMapping providerMapping1 = new DbProviderMapping("provider1", typeof(SqlDatabase));
            section.ProviderMappings.Add(providerMapping1);
            DbProviderMapping providerMapping2 = new DbProviderMapping("provider2", typeof(SqlDatabase));
            section.ProviderMappings.Add(providerMapping2);

            MockRegistryKey providerMappingsMachineKey = new MockRegistryKey(false);
            machineKey.AddSubKey(DatabaseSettingsManageabilityProvider.ProviderMappingsKeyName,
                                 providerMappingsMachineKey);
            MockRegistryKey providerMapping1MachineKey = new MockRegistryKey(false);
            providerMappingsMachineKey.AddSubKey("provider1",
                                                 providerMapping1MachineKey);
            providerMapping1MachineKey.AddBooleanValue(DatabaseSettingsManageabilityProvider.PolicyValueName, false);
            MockRegistryKey providerMapping2MachineKey = new MockRegistryKey(false);
            providerMappingsMachineKey.AddSubKey("provider2",
                                                 providerMapping2MachineKey);
            providerMapping2MachineKey.AddBooleanValue(DatabaseSettingsManageabilityProvider.PolicyValueName, true);
            providerMapping2MachineKey.AddStringValue(DatabaseSettingsManageabilityProvider.DatabaseTypePropertyName,
                                                      typeof(GenericDatabase).AssemblyQualifiedName);

            provider.OverrideWithGroupPolicies(section, true, machineKey, userKey);

            Assert.AreEqual(1, section.ProviderMappings.Count);
            Assert.IsNotNull(section.ProviderMappings.Get("provider2"));

            Assert.IsTrue(MockRegistryKey.CheckAllClosed(providerMapping1MachineKey, providerMapping2MachineKey, providerMappingsMachineKey));
        }