1 implementation of IAntiforgery
Microsoft.AspNetCore.Antiforgery (1)
Internal\DefaultAntiforgery.cs (1)
17internal sealed class DefaultAntiforgery : IAntiforgery
61 references to IAntiforgery
Microsoft.AspNetCore.Antiforgery (4)
AntiforgeryApplicationBuilderExtensions.cs (1)
34if (builder.ApplicationServices.GetService(typeof(IAntiforgery)) == null)
AntiforgeryMiddleware.cs (2)
8internal sealed class AntiforgeryMiddleware(IAntiforgery antiforgery, RequestDelegate next) 11private readonly IAntiforgery _antiforgery = antiforgery;
AntiforgeryServiceCollectionExtensions.cs (1)
31services.TryAddSingleton<IAntiforgery, DefaultAntiforgery>();
Microsoft.AspNetCore.Antiforgery.Test (6)
AntiforgeryApplicationBuilderExtensionsTest.cs (2)
16var antiforgeryService = new Mock<IAntiforgery>(); 50private IServiceProvider CreateServices(IAntiforgery? antiforgeryService = null)
AntiforgeryMiddlewareTest.cs (4)
18var antiforgeryService = new Mock<IAntiforgery>(); 33var antiforgeryService = new Mock<IAntiforgery>(); 51var antiforgeryService = new Mock<IAntiforgery>(); 66var antiforgeryService = new Mock<IAntiforgery>();
Microsoft.AspNetCore.Components.Endpoints (4)
Forms\EndpointAntiforgeryStateProvider.cs (1)
10internal class EndpointAntiforgeryStateProvider(IAntiforgery antiforgery, PersistentComponentState state) : DefaultAntiforgeryStateProvider(state)
RazorComponentEndpointInvoker.cs (3)
60var antiforgery = context.RequestServices.GetRequiredService<IAntiforgery>(); 160private async Task<RequestValidationState> ValidateRequestAsync(HttpContext context, IAntiforgery? antiforgery)
Microsoft.AspNetCore.Mvc.FunctionalTests (10)
AntiforgeryMiddlewareTest.cs (8)
36var antiforgery = app.Services.GetRequiredService<IAntiforgery>(); 120var antiforgery = app.Services.GetRequiredService<IAntiforgery>(); 152var antiforgery = app.Services.GetRequiredService<IAntiforgery>(); 184var antiforgery = app.Services.GetRequiredService<IAntiforgery>();
SimpleWithWebApplicationBuilderTests.cs (2)
266var antiforgery = Factory.Services.GetRequiredService<IAntiforgery>();
Microsoft.AspNetCore.Mvc.Razor (2)
RazorPageBase.cs (2)
716var antiforgery = viewContext.HttpContext.RequestServices.GetRequiredService<IAntiforgery>();
Microsoft.AspNetCore.Mvc.TagHelpers.Test (1)
TestableHtmlGenerator.cs (1)
45Mock.Of<IAntiforgery>(),
Microsoft.AspNetCore.Mvc.ViewFeatures (9)
AntiforgeryExtensions.cs (3)
14/// Static class that adds extension methods to <see cref="IAntiforgery"/>. This class cannot be inherited. 21/// <param name="antiforgery">The <see cref="IAntiforgery"/> instance.</param> 31public static IHtmlContent GetHtml(this IAntiforgery antiforgery, HttpContext httpContext)
DefaultHtmlGenerator.cs (3)
38private readonly IAntiforgery _antiforgery; 48/// <param name="antiforgery">The <see cref="IAntiforgery"/> instance which is used to generate antiforgery 56IAntiforgery antiforgery,
Filters\AutoValidateAntiforgeryTokenAuthorizationFilter.cs (1)
13public AutoValidateAntiforgeryTokenAuthorizationFilter(IAntiforgery antiforgery, ILoggerFactory loggerFactory)
Filters\ValidateAntiforgeryTokenAuthorizationFilter.cs (2)
12private readonly IAntiforgery _antiforgery; 15public ValidateAntiforgeryTokenAuthorizationFilter(IAntiforgery antiforgery, ILoggerFactory loggerFactory)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (9)
AntiforgeryExtensionsTest.cs (2)
11/// Extension methods for <see cref="IAntiforgery"/>. 19var antiforgery = new Mock<IAntiforgery>(MockBehavior.Strict);
DefaultHtmlGeneratorTest.cs (1)
1008var antiforgery = new Mock<IAntiforgery>();
Filters\AutoValidateAntiforgeryTokenAuthorizationFilterTest.cs (3)
23var antiforgery = new Mock<IAntiforgery>(MockBehavior.Strict); 51var antiforgery = new Mock<IAntiforgery>(MockBehavior.Strict); 75var antiforgery = new Mock<IAntiforgery>(MockBehavior.Strict);
Filters\ValidateAntiforgeryTokenAuthorizationFilterTest.cs (3)
27var antiforgery = new Mock<IAntiforgery>(MockBehavior.Strict); 51var antiforgery = new Mock<IAntiforgery>(MockBehavior.Strict); 79var antiforgery = new Mock<IAntiforgery>(MockBehavior.Strict);
Microsoft.AspNetCore.Mvc.Views.TestCommon (1)
HtmlGeneratorUtilities.cs (1)
40Mock.Of<IAntiforgery>(),
Microsoft.AspNetCore.Routing.FunctionalTests (14)
MinimalFormTests.cs (14)
50var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 110var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 471var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 530var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 582var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 634var antiforgery = host.Services.GetRequiredService<IAntiforgery>(); 683var antiforgery = host.Services.GetRequiredService<IAntiforgery>();
MinimalFormSample (1)
Program.cs (1)
16app.MapGet("/antiforgery", (HttpContext context, IAntiforgery antiforgery) =>