Search code examples
asp.net-mvccertificatesmartcardidentityserver4

How to get client certificates through identity server 4?


I am trying to build authentication system through ASP.NET MVC. I am using Identity Server 4 for authentication. I have already implemented user id and password validation through ResourceOwner.
Now I am trying to implement smart card authentication. When I try to read X509Certificate2 in debug mode, I am able to read the client certificates but when I deploy the application to IIS, I am unable to read the certificate.
I want to accept client certificate on my Identity Server hosted on IIS when request is sent to Identity Server 4 from client ASP.NET MVC. My Identity Server 4 project type is .NET Core on .NET Framework.

I have already tried this:

  1. Installed authorized SSL certificate on IIS
  2. Added HTTPS binding to my identity server 4 app pool with valid port number.
  3. Enable SSL for the identity server site and set to accept client certificate.

Solution

  • I got the client certificate in Identity Server 4 as below but it was without private key : var clientX509Certificate = new X509Certificate2(this.HttpContext.Connection.ClientCertificate);