I'm trying to implement custom client certificate validation for an integration test setup. I'm using ASP.NET Core 2.1.latest and Kestrel like so:
new WebHostBuilder()
.UseKestrel(
ok => ok.ConfigureHttpsDefaults(
o =>
{
o.ClientCertificateMode = ClientCertificateMode.AllowCertificate;
o.ClientCertificateValidation = RememberClientCertificate;
}))
[..]
.UseUrls("https://localhost:5051")
[..]
private static bool RememberClientCertificate (X509Certificate2 clientCertificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
LastClientCertificate = clientCertificate;
return true;
}
However, my function RememberClientCertificate is never ever called. Regardless of whether I'm sending a client certificate or not.
What am I doing wrong?