CertificateFailedValidation event is not logging the ChainErrors as expected.
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
In CertificateAuthenticationHandler line 155 you log event: Logger.CertificateFailedValidation(clientCertificate.Subject, chainErrors);
but the chainErrors logs this:
System.Collections.Generic.List
1[System.String]`
You need to log the values of the chainErrors. Otherwise this is not a helpful message.
Expected Behavior
Log the chain errors in the list.
Steps To Reproduce
Call a service using certificate authentication handler with a certificate that has a root that is not installed in the server. This should give chain errors. Check the logs and you’ll see the chain errors are not logged properly.
From our service we see this event: name: Microsoft.AspNetCore.Authentication.Certificate.CertificateAuthenticationHandler body: Certificate validation failed, subject was {Subject}. {ChainErrors} subject: CN=scrapped.net chain errors: System.Collections.Generic.List`1[System.String]
Exceptions (if any)
No response
.NET Version
6.0.301
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:13 (13 by maintainers)
Thanks again for the fix @jupacaza and your input @martincostello
Just to clarify, @jupacaza you did verified that your fix works for your scenario right? Just not the structured logging scenario via alternate loggers?