56 references to RequireAssertion
BasicTestApp (1)
Program.cs (1)
39policy.RequireAssertion(ctx => ctx.User.Identity.Name?.StartsWith('B') ?? false));
Microsoft.AspNetCore.Authorization.Test (27)
AuthorizationBuilderTests.cs (1)
95.AddPolicy("name", p => p.RequireAssertion(_ => true));
AuthorizationEndpointConventionBuilderExtensionsTests.cs (2)
125var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 199var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build();
AuthorizationMiddlewareTests.cs (10)
108policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 194var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 236var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 278var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 344return Task.FromResult(new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 356var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 388var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 423var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => 652var policy = new AuthorizationPolicyBuilder().RequireAssertion(c => 681var policy = new AuthorizationPolicyBuilder().RequireAssertion(c =>
AuthorizationPolicyFacts.cs (1)
55var policies = new[] { new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build() };
DefaultAuthorizationServiceTests.cs (5)
964options.AddPolicy("Basic", policy => policy.RequireAssertion(context => true)); 1022options.AddPolicy("Basic", policy => policy.RequireAssertion(context => true)); 1085services.AddAuthorization(options => options.AddPolicy("Fail", p => p.RequireAssertion(c => false))); 1126services.AddAuthorization(options => options.AddPolicy("Success", p => p.RequireAssertion(c => true))); 1145services.AddAuthorization(options => options.AddPolicy("Success", p => p.RequireAssertion(c => true)));
PolicyEvaluatorTests.cs (8)
21var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 38var policy = new AuthorizationPolicyBuilder().AddAuthenticationSchemes("A", "B", "C").RequireAssertion(_ => true).Build(); 57var policy = new AuthorizationPolicyBuilder().AddAuthenticationSchemes("A").RequireAssertion(_ => true).Build(); 74var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 91var policy = new AuthorizationPolicyBuilder().RequireAssertion(c => c.Resource != null).Build(); 109var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => false).Build(); 126var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => false).Build(); 145.RequireAssertion(_ => false)
Microsoft.AspNetCore.Http.Connections.Tests (1)
MapConnectionHandlerTests.cs (1)
37var policy1 = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build();
Microsoft.AspNetCore.Mvc.Core.Test (17)
Authorization\AuthorizeFilterTest.cs (17)
88var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 105policyProvider.Setup(p => p.GetPolicyAsync(It.IsAny<string>())).ReturnsAsync(new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()) 132var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 234new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 236new AuthorizationPolicyBuilder().RequireAssertion(_ => false).Build(); 265var secondFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => true).Build()); 289var secondFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => true).Build()); 315var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => false).Build()); 319var secondFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => true).Build()); 333var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => false).Build()); 337var secondFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => false).Build()); 351var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => true).Build()); 369public DerivedAuthorizeFilter() : base(new AuthorizationPolicyBuilder().RequireAssertion(a => false).Build()) 377var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(c => c.Resource is AuthorizationFilterContext).Build()); 424.RequireAssertion(_ => true) 440.RequireAssertion(_ => true) 474.RequireAssertion(_ => true)
Microsoft.AspNetCore.Mvc.IntegrationTests (4)
AuthorizeFilterIntegrationTest.cs (4)
58var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 89var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 105var secondFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => true).Build()); 141var secondFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAssertion(a => true).Build());
Microsoft.AspNetCore.Routing.FunctionalTests (4)
EndpointRoutingIntegrationTest.cs (4)
111services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 143services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 204services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 235services.AddAuthorization(options => options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build());
Microsoft.AspNetCore.SignalR.Tests (1)
MapSignalRTests.cs (1)
106var policy1 = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build();
StaticFilesAuth (1)
Startup.cs (1)
37builder.RequireAuthenticatedUser().RequireAssertion(context =>