简体   繁体   English

是否有ASP.NET MVC的混合身份验证处理ASP.NET模块(MADAM)的端口?

[英]Is there a port of the Mixed Authentication Disposition ASP.NET Module (MADAM) for ASP.NET MVC?

The Mixed Authentication Disposition ASP.NET Module (MADAM) is exactly what I need for the project I'm building in MVC2. 混合身份验证配置ASP.NET模块(MADAM)正是我在MVC2中构建的项目所需要的。 I'm not an expert on authentication, could MADAM be quickly retrofitted to work with the MVC pipeline? 我不是身份验证方面的专家,是否可以快速改装MADAM以使用MVC管道?

http://msdn.microsoft.com/en-us/library/aa479391.aspx http://msdn.microsoft.com/en-us/library/aa479391.aspx

说明FormsAuthenticationDispositionModule如何挂起Forms身份验证工作流,以及FormsAuthenticationDispositionModule完成其工作后BasicAuthenticationModule如何向传出响应添加必要的标头。

Depending on your Server Version of IIS, you will need to place the MADAM modules into different locations within your web.config file. 根据您的IIS服务器版本,您需要将MADAM模块放在web.config文件中的不同位置。

IIS 6 IIS 6

<system.web>
 <httpHandelers>
<-- Madam Modules go here -->
 </httpHandelers>
</system.web>

IIS 7 IIS 7

<system.webServer>
 <httpHandelers>
<-- Madam Modules go here -->
 </httpHandelers>
</system.webServer>

I have been looking into using MADAM for my current project at work as well, however I cannot seem to get it to fire. 我一直在考虑将MADAM用于我当前的工作项目,但是我似乎无法解决这个问题。

It would appear that something has changed in the way that either ASP.Net processes requests and deals with HttpModules or it is a difference in the ASP.Net MVC pipeline. 似乎ASP.Net处理请求和处理HttpModules的方式发生了变化,或者ASP.Net MVC管道的差异。

The quickest solution that I have been able to find is to split the project into two separate projects and host them as different applications in IIS otherwise the authentication will not work as desire. 我能找到的最快的解决方案是将项目拆分为两个单独的项目,并将它们作为IIS中的不同应用程序托管,否则身份验证将无法正常工作。

As far as I can tell if you leave Forms Authentication on, MADAM does not fire and any paths which you wanted Http-Basic authentication for just redirect to the login/or default page. 据我所知,如果你打开表单身份验证,MADAM不会触发,你想要Http-Basic身份验证的任何路径只是重定向到登录/或默认页面。 If you have Forms Authentication off then the Http-Basic authentication will work, but the Forms Authentication will not work as it cannot read the .ASPXAUTH cookie automatically. 如果您关闭了表单身份验证,那么Http-Basic身份验证将起作用,但表单身份验证将无法正常工作,因为它无法自动读取.ASPXAUTH cookie。

Unless I stumble across some way to get it working I will have to split this project into two and host each as a separate application in IIS. 除非我偶然发现某种方式使其工作,否则我必须将此项目拆分为两个并将每个项目作为IIS中的单独应用程序托管。

If you have any other work arounds they would be gratefully received. 如果您有任何其他工作,他们将非常感激地收到。

I haven't used MADAM, but based on the diagram I don't see any reason why you couldn't implement this process in an AuthorizationFilter or wire it up directly to HttpApplication.AuthorizeRequest event. 我没有使用过MADAM,但基于图表,我没有看到任何理由导致您无法在AuthorizationFilter实现此过程或直接将其连接到HttpApplication.AuthorizeRequest事件。 ASP.NET MVC is still subject to the ASP.NET HttpApplication life cycle. ASP.NET MVC仍然受ASP.NET HttpApplication生命周期的影响。

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

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