Error configuring fluentsecurity

144 Views Asked by At

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?

1

There are 1 best solutions below

0
Tieson T. On BEST ANSWER

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();