Skip to content

Clarify certificate validation cache behavior and requirements - #37436

Open
cincuranet wants to merge 1 commit into
dotnet:mainfrom
cincuranet:add-cert-docs
Open

Clarify certificate validation cache behavior and requirements#37436
cincuranet wants to merge 1 commit into
dotnet:mainfrom
cincuranet:add-cert-docs

Conversation

@cincuranet

@cincuranet cincuranet commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@cincuranet
cincuranet requested a review from blowdart August 7, 2026 09:28

@guardrex guardrex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cincuranet! ... The article probably doesn't cross-link the API in other spots, but let's get the ball rolling by adding the links to this paragraph. Most of the security articles are receiving overhauls, and we'll add links elsewhere later. Also, let's assume one subject for the last sentence ("you") by striking the comma.


:::code language="csharp" source="certauth/samples/6.x/CertAuthSample/Snippets/Program.cs" id="snippet_AddCertificateCaching":::

When `AddCertificateCache` is enabled, the result produced by `OnCertificateValidated` must be a pure function of the authentication scheme and certificate. Don't base the result on request context because the cached result is reused for subsequent requests. Place request-context-dependent decisions in an authorization policy, or provide a context-aware implementation of `ICertificateValidationCache`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When `AddCertificateCache` is enabled, the result produced by `OnCertificateValidated` must be a pure function of the authentication scheme and certificate. Don't base the result on request context because the cached result is reused for subsequent requests. Place request-context-dependent decisions in an authorization policy, or provide a context-aware implementation of `ICertificateValidationCache`.
When <xref:Microsoft.Extensions.DependencyInjection.CertificateAuthenticationAppBuilderExtensions.AddCertificateCache%2A> is enabled, the result produced by <xref:Microsoft.AspNetCore.Authentication.Certificate.CertificateAuthenticationEvents.OnCertificateValidated%2A> must be a pure function of the authentication scheme and certificate. Don't base the result on request context because the cached result is reused for subsequent requests. Place request-context-dependent decisions in an authorization policy or provide a context-aware implementation of <xref:Microsoft.AspNetCore.Authentication.Certificate.ICertificateValidationCache>.

@javiercn

javiercn commented Aug 7, 2026

Copy link
Copy Markdown
Member

@guardrex can you fix it and get it merged?

@guardrex guardrex self-assigned this Aug 8, 2026
@guardrex

guardrex commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

@javiercn (cc: @danroth27) ... Several new rules have been instituted by the docs division, and I may have lost some repo authority. I no longer have that power. I can't edit PRs directly any longer (I must open a PR against the sender's branch), nor can I accept/approve my own suggestions ☝️. I can't merge my PRs any longer without someone else's approval, even if Copilot generated the PR and made all of the commits ... and even if I'm only fixing a spelling error. I can't approve and leave suggestions for someone else's PR ... they now have to ping me again for another review after they accept my suggestions. These new rules have slowed things down.

@cincuranet ... You'll need to commit my suggestion, and then I can approve the PR. Alternatively, I think @wadepickett or @tdykstra can approve the suggestions because I think they're repo owners with more powers than I have.

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

Successfully merging this pull request may close these issues.

Clarify certificate validation cache behavior and requirements

3 participants