The scenario is as follows: Users connect to a webserver using certificate authentication, the server is making calls to other services and I would like to forward/send the certificate that I received on the server to the authenticate the user by services.
I am using the following code on the webserver to set the client certificate on HttpClientHandler and I can see in debug mode that the client certificate is valid in the HttpContext below.
X509Certificate2 cert = new X509Certificate2(HttpContext.Request.ClientCertificate.Certificate);
var httpClientHandler = new WebRequestHandler();
httpClientHandler.UseDefaultCredentials = true;
httpClientHandler.PreAuthenticate = true;
httpClientHandler.ClientCertificateOptions = ClientCertificateOption.Manual;
httpClientHandler.ClientCertificates.Add(cert);
When I receive the request in service code, the certificate has been stripped off (or it could be that the above code never sent it). Any ideas whats going on and what should be different in the code above?
FYI both the web-server and the services are running on the same machine. To be more precise the services run as applications within the same website on IIS