dotnet / dotnet/aspnetcore

ShoudValidate for Antiforgery Tokens in Minimal APIs

Open
#63,663 7 comments 1 reaction 0 assignees View on GitHub
area-security feature-antiforgery
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Add multiple authentication providers configured. (ie. SAML+cookie and OAuth+JWT).
Add the built in Antiforgery CSRF protection.
Endpoints can accept requests using either authentication method.

For the Antiforgery token validator, I would like to have an easy way to configure when to run validation or not, so that I can disable it when the client uses a JWT token.

### Describe the solution you'd like

An override option for the built in middleware or exposing a `ShouldValidate()` `Func<>` option in Add/UseAntiforgery methods.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.