MVC4试图让安全模型与我的工作环境 [英] MVC4 Trying to get the security model to work with my Environment

查看:100
本文介绍了MVC4试图让安全模型与我的工作环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能够把我在正确的轨道上,一直在努力,现在解决这个好几个小时。结果
我目前在重新开发一个Web应用程序的过程中,我想用MVC4属性管理访问应用程序的各个部分。
我遇到的问题是,认证和放大器;权限是由Web应用程序与接口的中间件应用程序的所有处理。

I hope someone will be able to put me on the right track, been trying to resolve this now for hours.
I am currently in the process of redeveloping a web application and I would like to use the MVC4 attributes for managing access to the various parts of the application. The issue I am having is that the Authentication & Permissions are all handled by middle-ware applications that the web app has to interface with.

如果即使有这个限制,我将能够使用的安全我不知道属性和放大器;让Web应用程序知道用户进行身份验证。

I was wondering if even with this restriction would I be able to use the security attributes & letting the web app know that the user is Authenticated.

推荐答案

是的,你将能够使用现有的授权属性。所有你需要做的就是编写一个自定义 成员 和的 角色 将使用而不是依靠默认的SQL数据库上现有的服务提供商。

Yes, you will be able to use existing Authorize attribute. All you have to do is write a custom Membership and Role providers that will use your existing services instead of relying on the default SQL database.

如果你不想去通过所有这些麻烦,你也可以编写一个定制的授权属性(从派生 AuthorizeAttribute ),并在 AuthorizeCore 方法来调用服务来检查当前用户是否具有所需的角色。

If you don't want to go through all this hassle you could also write a custom authorization attribute (deriving from AuthorizeAttribute) and inside the AuthorizeCore method call your service to check whether the current user has the desired roles.

这篇关于MVC4试图让安全模型与我的工作环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆