码迷,mamicode.com
首页 > Windows程序 > 详细

Asp.net Security API --- FluentSecurity

时间:2014-08-26 11:11:06      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   for   ar   2014   

FluentSecurity is an class library to secure your Asp.net website

一、Install

bubuko.com,布布扣

二、Config into Global.asax

bubuko.com,布布扣
 private void SetPolicy()
        {
            // set security 
            SecurityConfigurator.Configure(config =>
            {
                config.GetAuthenticationStatusFrom(() => UserVerify.IsUserAuth());



                config.For<HomeController>().Ignore();
                config.For<UsersController>().AddPolicy(new RolePolicy(Roles.Admin));
                config.For<TestPlanController>().AddPolicy(new RolePolicy(Roles.Admin, Roles.Lead, Roles.Guest));
                config.For<CollectionsController>().AddPolicy(new RolePolicy(Roles.Admin, Roles.Lead));
                config.For<TemplatesController>().AddPolicy(new RolePolicy(Roles.Lead, Roles.Admin));
                config.For<AppsController>().AddPolicy(new RolePolicy(Roles.Admin, Roles.Lead, Roles.Guest, Roles.Dev));
                config.For<GauntletController>().AddPolicy(new RolePolicy(Roles.Admin, Roles.Lead, Roles.Dev));
                //config.For<AdminController>().AddPolicy(new RolePolicy(Roles.Admin));
                config.For<ToolsController>().AddPolicy(new RolePolicy(Roles.Admin));
            });

            GlobalFilters.Filters.Add(new HandleSecurityAttribute(), 0);
        }
View Code


三、Tutorial address

http://blog.mariusschulz.com/2011/12/05/securing-an-aspnet-mvc-application-using-fluentsecurity

 

Asp.net Security API --- FluentSecurity

标签:style   blog   http   color   os   io   for   ar   2014   

原文地址:http://www.cnblogs.com/Luxuan/p/3936647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!