Security Application Block - Custom Saving Security Rules

Topics: Security Application Block
Feb 10, 2010 at 2:25 PM

I would like to save my security rules for my users. Does the library supports savings the security rules using SecuritySettings class?

I am having several problems using the Enterprise Library Configuration tool.  The exception looks like this: Error 1 An error occurred creating the configuration section handler for securityConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Security

I am reading the sules like this.

        static SecuritySettings GetSecuritySettings(IConfigurationSource configSource)
            IConfigurationSource configurationSource = configSource;

            SecuritySettings settings = (SecuritySettings)configurationSource.GetSection(SecuritySettings.SectionName);
            if (settings == null)
                throw new ConfigurationErrorsException(Resources.MissingSection);

            return settings;

        private void getSettingsNowToolStripMenuItem_Click(object sender, EventArgs e)
            SecuritySettings security = GetSecuritySettings( ConfigurationSourceFactory.Create());
            int AuthProvidersCount = security.AuthorizationProviders.Count;
            foreach (AuthorizationRuleProviderData authData in security.AuthorizationProviders)
                foreach (AuthorizationRuleData ruledata in authData.Rules)

Feb 11, 2010 at 5:22 AM

Ok, first, where is your securityConfiguration defined?  Is it the config file of your executable project? 

"Does the library supports savings the security rules using SecuritySettings class?"

- In v4.1, no. But check out the beta release of EntLib 5.0.  Read the Using the Fluent Configuration API section which allows you to modify entlib configuration during runtime and apply those changes.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.