/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Shared/AntiforgeryValidationFeature.cs
17 строк
949 B
Korolev Dmitry
[breaking] Defer antiforgery/CSRF rejection to form consumers via `IAntiforgeryValidationFeature` (#67082)
18 июн 2026, 19:09
Не верифицирован
18 июн 2026, 19:09
d54f274
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.AspNetCore.Antiforgery; // Shared between Microsoft.AspNetCore.Antiforgery (token-based validation) and Microsoft.AspNetCore // (cross-origin CSRF protection middleware). Both producers write the request result through the public // IAntiforgeryValidationFeature so downstream consumers (MVC, minimal APIs, Razor Components, FormFeature) // can react uniformly. The error is typed as Exception so this file does not depend on the concrete // exception type's assembly. internal sealed class AntiforgeryValidationFeature(bool isValid, Exception? error) : IAntiforgeryValidationFeature { public static readonly IAntiforgeryValidationFeature Valid = new AntiforgeryValidationFeature(true, null); public bool IsValid { get; } = isValid; public Exception? Error { get; } = error; }