Configure action in ASP.NET core that requires client certificate authentication

ASP.NET core

Assume we have an application with multiple login methods where one of the methods is a TLS client certificate.

First step, create a vritual dir "tls" with a web.config file that has the following content:


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
    </system.webServer>
  </location>
</configuration>
Then, edit the application web.config file and add this:

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

Post a Comment

Previous Post Next Post