[英]Partial Authentication with Azure Active Directory
My goal is to put certain pages in my MVC application behind authentication, and certain features behind authorized roles. 我的目标是将MVC应用程序中的某些页面置于身份验证之后,并将某些功能置于授权角色之后。 This is usually achieved with decorating controllers or methods with
[Authorize]
and putting parts of pages inside if(User.InRoles(...)){ ... }
. 通常可以通过使用
[Authorize]
装饰控制器或方法并将部分页面放入if(User.InRoles(...)){ ... }
。
However the moment I add Azure Active Directory authentication to my project every URL on my site redirects to the login page, regardless of whether or not the controller is behind [Authorize]
. 但是,当我将Azure Active Directory身份验证添加到项目时,站点上的每个URL都会重定向到登录页面,而不管控制器是否位于
[Authorize]
。 How can I provide the desired functionality using AAD? 如何使用AAD提供所需的功能?
Thanks to Brendan Green to pointing me to the answer. 感谢Brendan Green向我指出了答案。 The main change that is needed is changing the system.web to allow users.
需要进行的主要更改是更改system.web以允许用户使用。
<system.web>
<authorization>
<allow users="*" />
</authorization>
...
</system.web>
Please view my blog post for the full description of code changes. 请查看我的博客文章以获取代码更改的完整说明。
Partial Authentication in AAD using WS Federation 使用WS Federation的AAD中的部分身份验证
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.