Using the documentation on for authentication w/ Azure Web App _causes_ authentication failures
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.
- ID: 35b7960d-6de5-78ee-bc45-d7218239bbc8
- Version Independent ID: d2db534b-198a-dc99-5b5a-0525582d39ac
- Content: Configure certificate authentication in ASP.NET Core
- Content Source: aspnetcore/security/authentication/certauth.md
- Product: aspnet-core
- Technology: aspnetcore-security
- GitHub Login: @blowdart
- Microsoft Alias: bdorrans
When you say failures what do you mean?
The client-certificate is not forwarded. The authentication handler doesn't find the client-cert and returns the standard 403 response.
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.
OK this sounds more like a bug than a docs issue. Please log one on the aspnet repo and we'll go from there.
@Coderrob and add the aspnet repo issue here please.
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
Fixed this in this PR, waiting for approval
https://github.com/aspnet/AspNetCore.Docs/pull/16354