启用S​​SL客户端证书要求在Asp.Net MVC特定的控制器或者动作 [英] Enabling SSL Client Certificate Required for specific Controller or Action in Asp.Net MVC

查看:123
本文介绍了启用S​​SL客户端证书要求在Asp.Net MVC特定的控制器或者动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有需要SSL客户端证书的的具体的操作或者控制器任何MVC特定的方式,即非常多RequireHttps方式或授权的作品,但对于ClientCerts?

Is there any MVC specific way to require an SSL Client Certificate for a specific Action or Controller, i.e very much the way RequireHttps or Authorize works, but for ClientCerts?

我知道,你在网站上创建一个空文件夹,使用相同的名称为文件夹,然后一个控制器设置在web.config中规则的伎俩,但我不想做这种方式,我找了一个MVC解决方案,如果有一个。

I know about the trick where you create an empty folder in the site, a Controller with the same name as the folder and then set up a rule in web.config, but I don't want to do it this way, I am looking for an MVC solution if there is one.

(web.config中招的例子:)

(Example of the web.config trick:)

  <location path="/ClientCert">
    <system.webServer>
      <security>
        <access sslFlags="Ssl,SslRequireCert" />
      </security>
    </system.webServer>
  </location>

我很好奇,如果存在,可以在一个ActionFilter被包封的溶液和/或HTTP模块

I'm curious if there is a solution that can be encapsulated in an ActionFilter and/or HttpModule?

推荐答案

我不这么认为。客户端证书的处理和连接协商,这是跌多MVC方式降低过程中IIS或HTTP.sys中映射。如果正在使用的客户端证书用于SSL / TLS相互身份验证,则需要客户端证书只是建立HTTPS会话和连接。

I don't believe so. Client Certificates are handled and mapped in IIS or HTTP.sys during connection negotiation, which is way lower down than MVC. If that client certificate is being used for mutual authentication with SSL/TLS, then the client certificate is needed just to establish a HTTPS session and connection.

这一切发生以及MVC之前,或任何code对于这个问题,是有机会运行。这种情况下在内核中 HTTP.sys将

This all happens well before MVC, or any code for that matter, is given a chance to run. This happens down in the kernel in HTTP.sys.

这篇关于启用S​​SL客户端证书要求在Asp.Net MVC特定的控制器或者动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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