128 references to Build
Aspire.Dashboard (4)
DashboardWebApplication.cs (4)
772.Build()); 781.Build()); 788.Build()); 795.Build());
Aspire.Hosting (1)
Dashboard\DashboardServiceHost.cs (1)
102.Build());
CustomPolicyProvider (1)
Authorization\MinimumAgePolicyProvider.cs (1)
46return Task.FromResult(policy.Build());
Microsoft.AspNetCore.Authorization (6)
AuthorizationBuilder.cs (2)
115return AddDefaultPolicy(name, policyBuilder.Build()); 142return AddFallbackPolicy(name, policyBuilder.Build());
AuthorizationOptions.cs (2)
32public AuthorizationPolicy DefaultPolicy { get; set; } = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 69PolicyMap[name] = Task.FromResult<AuthorizationPolicy?>(policyBuilder.Build());
AuthorizationPolicy.cs (2)
86return builder.Build(); 199return policyBuilder?.Build();
Microsoft.AspNetCore.Authorization.Policy (3)
AuthorizationEndpointConventionBuilderExtensions.cs (1)
115RequirePolicyCore(builder, policyBuilder.Build());
AuthorizationMiddleware.cs (2)
136? reqPolicy.Build() 137: AuthorizationPolicy.Combine(policy, reqPolicy.Build());
Microsoft.AspNetCore.Authorization.Test (72)
AuthorizationBuilderTests.cs (4)
16var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 31var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 47var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 78var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
AuthorizationEndpointConventionBuilderExtensionsTests.cs (2)
125var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build(); 199var policy = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build();
AuthorizationMiddlewareResultHandlerTests.cs (7)
19var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 33var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 47var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 68.Build(); 86var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 107.Build(); 125var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
AuthorizationMiddlewareTests.cs (36)
27var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 46var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 66var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 85var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 106var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 108policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build()); 128var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 150var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 172var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().AddAuthenticationSchemes("schema1", "schema2").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(); 427}).Build(); 430policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 510policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 532policyProvider.Setup(p => p.GetDefaultPolicyAsync()).ReturnsAsync(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 547var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build(); 566var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 587var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build(); 608var policy = new AuthorizationPolicyBuilder("Fails").RequireAuthenticatedUser().Build(); 632var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewComment", "CanViewPage").Build(); 656}).Build(); 685}).Build(); 705var policy = new AuthorizationPolicyBuilder().RequireRole("Wut").Build(); 727var policy = new AuthorizationPolicyBuilder().RequireRole("Wut").AddAuthenticationSchemes("Basic", "Bearer").Build(); 750.Build(); 772var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build(); 795var policy = new AuthorizationPolicyBuilder().RequireRole("Wut").AddAuthenticationSchemes("NotImplemented").Build(); 818var policy = new AuthorizationPolicyBuilder().RequireRole("Wut").AddAuthenticationSchemes("Basic", "Bearer").Build(); 859var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build(); 885var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build(); 917var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").AddAuthenticationSchemes("Bearer").Build(); 951var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build();
AuthorizationPolicyFacts.cs (2)
55var policies = new[] { new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build() }; 78options.DefaultPolicy = new AuthorizationPolicyBuilder("default").RequireClaim("default").Build();
DefaultAuthorizationServiceTests.cs (13)
361var allowed = await authorizationService.AuthorizeAsync(user, policy.Build()); 382var allowed = await authorizationService.AuthorizeAsync(user, policy.Build()); 399var allowed = await authorizationService.AuthorizeAsync(user, policy.Build()); 416var allowed = await authorizationService.AuthorizeAsync(user, null, policy.Build()); 432var allowed = await authorizationService.AuthorizeAsync(user, policy.Build()); 453var allowed = await authorizationService.AuthorizeAsync(user, policy.Build()); 725var basePolicy = new AuthorizationPolicyBuilder().RequireClaim("Base", "Value").Build(); 753var basePolicy = new AuthorizationPolicyBuilder().RequireClaim("Base", "Value").Build(); 780var basePolicy = new AuthorizationPolicyBuilder().RequireClaim("Base", "Value").Build(); 999return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 1009return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 1038return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 1048return Task.FromResult(new AuthorizationPolicyBuilder().RequireClaim(policyName).Build());
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(); 146.Build();
Microsoft.AspNetCore.Http.Connections.Tests (1)
MapConnectionHandlerTests.cs (1)
37var policy1 = new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build();
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Infrastructure\FunctionalTestsServiceCollectionExtensions.cs (1)
49.Build();
Microsoft.AspNetCore.Mvc.Core (1)
Authorization\AuthorizeFilter.cs (1)
155return builder.Build();
Microsoft.AspNetCore.Mvc.Core.Test (29)
Authorization\AuthorizeFilterTest.cs (29)
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()); 146var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build()); 160var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 175var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 191var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 207.Build()); 221var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewComment", "CanViewPage").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()); 391var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireRole("Wut").Build()); 408.Build()); 425.Build()); 441.Build()); 475.Build(); 516.Build(); 520.Build(); 541.Build(); 545.Build();
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();