是否有任何软件包等实现了 MVC3 的动态角色控制器访问?
我已使用带有角色的标准 Authorize 属性静态允许访问控制器/操作方法。我正在使用默认的 ASP.Net 会员提供程序。
我们的一位客户想要更细粒度的访问控制。他们希望能够动态分配哪些角色可以访问哪些控制器/操作等。我看到的答案说实现 CustomAuthorize 属性。
只是想知道是否有任何工具包等。这似乎是一个相当标准的功能。我猜是这样的 http://kbochevski.blogspot.com/2009/ 11/mvc-custom-authorization.html
I have statically allowed access to controllers/action methods using the standard Authorize attribute with roles. I am using the default ASP.Net Membership Provider.
One of our clients wants finer grained access control. They would like to be able to dynamically assign which roles can access which controllers/actions etc. I've seen answers saying implement a CustomAuthorize Attribute.
Just wondered if there were any toolkits etc to this. It seems a reasonably standard feature. I guess something like this http://kbochevski.blogspot.com/2009/11/mvc-custom-authorization.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试像这样的自定义属性:
只需将此属性放在任何需要授权的操作方法上,并使用控制器名称和操作名称在数据库中进行查找即可获取所需的角色。
希望这有帮助,
马克
Try a custom attribute like this:
Just put this attribute on any action method that requires authorization and do a look up in a database with the controller name and action name to get the required roles.
Hope this helps,
Mark