简体   繁体   English

像PHP的ACL蛋糕PHP

[英]Cake php like ACL for ASP.net Mvc

I am looking for ACL based security. 我正在寻找基于ACL的安全性。 I have found Cake php's ACL very suitable for my project. 我发现Cake php的ACL非常适合我的项目。 Does anyone know any similar framework for asp.net mvc. 有谁知道asp.net mvc的任何类似框架。

Thanks in advance 提前致谢

The Cake PHP ACL system looks quite powerful. Cake PHP ACL系统看起来非常强大。 However, I'm not aware of a hierarchical system available out-of-the-box for ASP.Net MVC. 但是,我不知道现成的可用于ASP.Net MVC的分层系统。

The standard means to control access to resources (eg controllers) is via Roll Based Security . 控制对资源(例如控制器)访问的标准方法是通过Roll Based Security

You can always check if the current user is in a given role, eg 您可以随时检查当前用户是否具有给定角色,例如

bool isInSomeRole = HttpContext.Current.User.IsInRole("SomeRole");

The AuthorizeAttribute simplifies such checks for controller actions: AuthorizeAttribute简化了对控制器操作的检查:

[Authorize(Roles = "Customer")]
public ActionResult Index()
{
    ViewBag.Message = "Dashboard";

    return View();
}

Finally, here's a must-read article if you want to thoroughly understand MVC security 最后,如果您想彻底了解MVC安全性,那么这是必读文章

http://blogs.msdn.com/b/rickandy/archive/2012/03/23/securing-your-asp-net-mvc-4-app-and-the-new-allowanonymous-attribute.aspx http://blogs.msdn.com/b/rickandy/archive/2012/03/23/securing-your-asp-net-mvc-4-app-and-the-new-allowanonymous-attribute.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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