简体   繁体   中英

Error configuring fluentsecurity

I've installed and configured Fluentsecurity as specified in FluentSecurity - Getting Started in an asp.net MVC5 app. But i get an error when i ignore missing configuration.

The error message is " FluentSecurity.ConfigurationExpression does not contain a definition for IgnoreMissingConfiguration "

SecurityConfigurator.Configure(configuration =>
        {
            // Let FluentSecurity know how to get the authentication status of the current user
            configuration.GetAuthenticationStatusFrom(() => HttpContext.Current.User.Identity.IsAuthenticated);

            // This is where you set up the policies you want FluentSecurity to enforce on your controllers and actions
            configuration.For<HomeController>().Ignore();
            configuration.For<AccountController>().DenyAuthenticatedAccess();
            //configuration.For<AccountController>(x => x.()).DenyAnonymousAccess();
            configuration.For<AccountController>(x => x.LogOff()).DenyAnonymousAccess();
            configuration.For<AccountController>(x => x.Login("")).Ignore();
            configuration.IgnoreMissingConfiguration();

            configuration.For<GuestsController>(x => x.Index()).Ignore();
            configuration.For<GuestsController>(x => x.Create()).RequireRole(BlogRole.Writer);
        });

What am i missing here Please?

The example shown on the website is slightly out of date with the current version of the project (2.1.0). The IgnoreMissingConfiguration method is defined on a separate class, accessed via the Advanced property. So, change this:

configuration.IgnoreMissingConfiguration();

to

configuration.Advanced.IgnoreMissingConfiguration();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM