AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

Using the documentation on for authentication w/ Azure Web App _causes_ authentication failures

Open Coderrob opened this issue 7 years ago • 7 comments

When using the client certificate forwarding and code referenced in the section "Use certificate authentication in Azure Web Apps" causes failures in receiving a client-certificate when hosted in Azure App Service. Using a .Net Core 3.0 API hosted by an Azure App Service, w/ Require incoming certificate enabled, the handler fails to receive a client certificate.

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/certauth?view=aspnetcore-3.0#use-certificate-authentication-in-azure-web-apps

Removing the add/use certificate forwarding functions corrected the behavior and a client-certificate is received successfully. After that validation works as expected. Raising a flag in case the documentation is invalid and others run into the same situation.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Coderrob avatar Nov 18 '19 20:11 Coderrob

When you say failures what do you mean?

blowdart avatar Nov 18 '19 20:11 blowdart

The client-certificate is not forwarded. The authentication handler doesn't find the client-cert and returns the standard 403 response.

Coderrob avatar Nov 18 '19 21:11 Coderrob

Also seeing some behavior where in the CertificateAuthenticationHandler if the certificate is not identified as a self-signed certificate it'll bypass the verification flags to allow unknown certificate authority. Seems weird considering one of the cert auth options is AllowedCertificateTypes where the value can be set to All. With all I'd expect to potentially include an unknown CA or at least a way to pass the option flag down the handler to add it as a default flag on the policy.

Coderrob avatar Nov 18 '19 21:11 Coderrob

OK this sounds more like a bug than a docs issue. Please log one on the aspnet repo and we'll go from there.

blowdart avatar Nov 18 '19 23:11 blowdart

@Coderrob and add the aspnet repo issue here please.

Rick-Anderson avatar Nov 19 '19 07:11 Rick-Anderson

Still seeing this issue. Did everything in this article. Worked locally in IIS Express but not in Azure App Service. Header is there but "OnCertificateValidated" is never called. Deleted the "services.AddCertificateForwarding" boom everything works. Has an issue been logged for this?? It cost me a couple hours... @blowdart @coderrob

keithdv avatar Feb 07 '20 22:02 keithdv

@keithdv

Fixed this in this PR, waiting for approval

https://github.com/aspnet/AspNetCore.Docs/pull/16354

damienbod avatar Feb 08 '20 06:02 damienbod