128 references to AuthorizationPolicyBuilder
Aspire.Dashboard (4)
DashboardWebApplication.cs (4)
770
policy: new
AuthorizationPolicyBuilder
(OtlpCompositeAuthenticationDefaults.AuthenticationScheme)
779
policy: new
AuthorizationPolicyBuilder
(FrontendCompositeAuthenticationDefaults.AuthenticationScheme)
786
policy: new
AuthorizationPolicyBuilder
(FrontendCompositeAuthenticationDefaults.AuthenticationScheme)
793
policy: new
AuthorizationPolicyBuilder
(FrontendCompositeAuthenticationDefaults.AuthenticationScheme)
Aspire.Hosting (1)
Dashboard\DashboardServiceHost.cs (1)
99
policy: new
AuthorizationPolicyBuilder
(
CustomPolicyProvider (1)
Authorization\MinimumAgePolicyProvider.cs (1)
44
var policy = new
AuthorizationPolicyBuilder
();
Microsoft.AspNetCore.Authorization (7)
AuthorizationBuilder.cs (2)
113
var policyBuilder = new
AuthorizationPolicyBuilder
();
140
var policyBuilder = new
AuthorizationPolicyBuilder
();
AuthorizationOptions.cs (2)
32
public AuthorizationPolicy DefaultPolicy { get; set; } = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
67
var policyBuilder = new
AuthorizationPolicyBuilder
();
AuthorizationPolicy.cs (3)
81
var builder = new
AuthorizationPolicyBuilder
();
137
policyBuilder = new
AuthorizationPolicyBuilder
();
181
policyBuilder ??=
new
();
Microsoft.AspNetCore.Authorization.Policy (2)
AuthorizationEndpointConventionBuilderExtensions.cs (1)
113
var policyBuilder = new
AuthorizationPolicyBuilder
();
AuthorizationMiddleware.cs (1)
125
var reqPolicy = new
AuthorizationPolicyBuilder
();
Microsoft.AspNetCore.Authorization.Test (73)
AuthorizationBuilderTests.cs (4)
16
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
31
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
47
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
78
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
AuthorizationEndpointConventionBuilderExtensionsTests.cs (2)
125
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
199
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
AuthorizationMiddlewareResultHandlerTests.cs (7)
19
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
33
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
47
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
65
var policy = new
AuthorizationPolicyBuilder
()
86
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
104
var policy = new
AuthorizationPolicyBuilder
()
125
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
AuthorizationMiddlewareTests.cs (36)
27
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
46
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
66
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
85
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
106
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
108
policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
128
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
150
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
172
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().AddAuthenticationSchemes("schema1", "schema2").Build();
194
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
236
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
278
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
344
return Task.FromResult(new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
356
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
388
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
423
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ =>
430
policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
510
policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
532
policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
547
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage").Build();
566
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
587
var policy = new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build();
608
var policy = new
AuthorizationPolicyBuilder
("Fails").RequireAuthenticatedUser().Build();
632
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewComment", "CanViewPage").Build();
652
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(c =>
681
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(c =>
705
var policy = new
AuthorizationPolicyBuilder
().RequireRole("Wut").Build();
727
var policy = new
AuthorizationPolicyBuilder
().RequireRole("Wut").AddAuthenticationSchemes("Basic", "Bearer").Build();
748
var policy = new
AuthorizationPolicyBuilder
()
772
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage").Build();
795
var policy = new
AuthorizationPolicyBuilder
().RequireRole("Wut").AddAuthenticationSchemes("NotImplemented").Build();
818
var policy = new
AuthorizationPolicyBuilder
().RequireRole("Wut").AddAuthenticationSchemes("Basic", "Bearer").Build();
859
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage").Build();
885
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage").Build();
917
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage").AddAuthenticationSchemes("Bearer").Build();
951
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage").Build();
AuthorizationPolicyFacts.cs (3)
14
Assert.Throws<InvalidOperationException>(() => new
AuthorizationPolicyBuilder
().RequireRole());
55
var policies = new[] { new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build() };
78
options.DefaultPolicy = new
AuthorizationPolicyBuilder
("default").RequireClaim("default").Build();
DefaultAuthorizationServiceTests.cs (13)
348
var policy = new
AuthorizationPolicyBuilder
().RequireRole("Administrator")
371
var policy = new
AuthorizationPolicyBuilder
().RequireClaim(ClaimTypes.Role);
392
var policy = new
AuthorizationPolicyBuilder
("AuthType").RequireClaim(ClaimTypes.Name);
409
var policy = new
AuthorizationPolicyBuilder
("AuthType").RequireRole("Admin");
426
var policy = new
AuthorizationPolicyBuilder
("AuthType").RequireRole("Admin", "Users");
442
var policy = new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage");
725
var basePolicy = new
AuthorizationPolicyBuilder
().RequireClaim("Base", "Value").Build();
753
var basePolicy = new
AuthorizationPolicyBuilder
().RequireClaim("Base", "Value").Build();
780
var basePolicy = new
AuthorizationPolicyBuilder
().RequireClaim("Base", "Value").Build();
999
return Task.FromResult(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
1009
return Task.FromResult(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
1038
return Task.FromResult(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
1048
return Task.FromResult(new
AuthorizationPolicyBuilder
().RequireClaim(policyName).Build());
PolicyEvaluatorTests.cs (8)
21
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
38
var policy = new
AuthorizationPolicyBuilder
().AddAuthenticationSchemes("A", "B", "C").RequireAssertion(_ => true).Build();
57
var policy = new
AuthorizationPolicyBuilder
().AddAuthenticationSchemes("A").RequireAssertion(_ => true).Build();
74
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
91
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(c => c.Resource != null).Build();
109
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => false).Build();
126
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => false).Build();
143
var policy = new
AuthorizationPolicyBuilder
()
Microsoft.AspNetCore.Http.Connections.Tests (1)
MapConnectionHandlerTests.cs (1)
37
var policy1 = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Infrastructure\FunctionalTestsServiceCollectionExtensions.cs (1)
47
var policy = new
AuthorizationPolicyBuilder
()
Microsoft.AspNetCore.Mvc.Core.Test (29)
Authorization\AuthorizeFilterTest.cs (29)
88
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
105
policyProvider.Setup(p => p.GetPolicyAsync(It.IsAny<string>())).ReturnsAsync(new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build())
132
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
146
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewPage").Build());
160
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
175
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
191
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAuthenticatedUser().Build());
205
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
("Fails")
221
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireClaim("Permission", "CanViewComment", "CanViewPage").Build());
234
new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
236
new
AuthorizationPolicyBuilder
().RequireAssertion(_ => false).Build();
265
var secondFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => true).Build());
289
var secondFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => true).Build());
315
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => false).Build());
319
var secondFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => true).Build());
333
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => false).Build());
337
var secondFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => false).Build());
351
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => true).Build());
369
public DerivedAuthorizeFilter() : base(new
AuthorizationPolicyBuilder
().RequireAssertion(a => false).Build())
377
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(c => c.Resource is AuthorizationFilterContext).Build());
391
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireRole("Wut").Build());
406
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
()
423
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
()
439
var authorizeFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
()
473
var policy = new
AuthorizationPolicyBuilder
()
514
var policy1 = new
AuthorizationPolicyBuilder
()
518
var policy2 = new
AuthorizationPolicyBuilder
()
539
var policy1 = new
AuthorizationPolicyBuilder
()
543
var policy2 = new
AuthorizationPolicyBuilder
()
Microsoft.AspNetCore.Mvc.IntegrationTests (4)
AuthorizeFilterIntegrationTest.cs (4)
58
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
89
var policy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();
105
var secondFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => true).Build());
141
var secondFilter = new AuthorizeFilter(new
AuthorizationPolicyBuilder
().RequireAssertion(a => true).Build());
Microsoft.AspNetCore.Routing.FunctionalTests (4)
EndpointRoutingIntegrationTest.cs (4)
111
services.AddAuthorization(options => options.DefaultPolicy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
143
services.AddAuthorization(options => options.DefaultPolicy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
204
services.AddAuthorization(options => options.DefaultPolicy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
235
services.AddAuthorization(options => options.DefaultPolicy = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build());
Microsoft.AspNetCore.SignalR.Tests (1)
MapSignalRTests.cs (1)
106
var policy1 = new
AuthorizationPolicyBuilder
().RequireAssertion(_ => true).Build();