首页 > 代码库 > Asp.net Security API --- FluentSecurity
Asp.net Security API --- FluentSecurity
FluentSecurity is an class library to secure your Asp.net website
一、Install
二、Config into Global.asax
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); }
三、Tutorial address
http://blog.mariusschulz.com/2011/12/05/securing-an-aspnet-mvc-application-using-fluentsecurity
Asp.net Security API --- FluentSecurity
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。