-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Add API to specify antiforgery request token source #52281
Copy link
Copy link
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatespending-ci-rerunWhen assigned to a PR indicates that the CI checks should be rerunWhen assigned to a PR indicates that the CI checks should be rerun
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatespending-ci-rerunWhen assigned to a PR indicates that the CI checks should be rerunWhen assigned to a PR indicates that the CI checks should be rerun
Type
Fields
Give feedbackNo fields configured for issues without a type.
Background and Motivation
#51912 (comment)
Proposed API
namespace Microsoft.AspNetCore.Antiforgery; public class AntiforgeryOptions { + public AntiforgeryRequestTokenSource RequestTokenSource { get; set; } } +[Flags] +public enum AntiforgeryRequestTokenSource +{ + Header = 1, + FormBody = 2, + HeaderOrFormBody = Header | FormBody +} public class RequireAntiforgeryTokenAttribute : Attribute, IAntiforgeryMetadata { + public AntiforgeryRequestTokenSource RequestTokenSource { get; init; } }Usage Examples
Alternative Designs
Risks