Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use global error handling to catch CertificateAuthenticationHandler errors leading to http response status 403 (forbidden) #6

Open
abrasat opened this issue Jan 11, 2023 · 0 comments

Comments

@abrasat
Copy link

abrasat commented Jan 11, 2023

Thanks for the very good article and for the code sample! I tried to use the approach from the sample to handle asp net core errors in case of invalid certificates rejected by the microsoft certificate authentication handler. The authentication handler identifies for instance an expired certificate (the generated log message is "Microsoft.AspNetCore.Authentication.Certificate.CertificateAuthenticationHandler @ LogMessage : Certificate validation failed, subject was CN=xxx. NotTimeValid...") and sends a 403 http response status to the client. I would like to add a middleware to "catch" the exception leading to the http response 403, in view to add a "response details" information. Unfortunately no exception is generated in the CustomExceptionMiddleware from the sample.... Is there some other mechanism available to handle the http response status 403?

@abrasat abrasat changed the title Use global error handling to catch CertificateAuthenticationHandler errors leading http response status 403 (forbidden) Use global error handling to catch CertificateAuthenticationHandler errors leading to http response status 403 (forbidden) Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant