51 references to AddPolicy
BasicTestApp (1)
Program.cs (1)
38options.AddPolicy("NameMustStartWithB", policy =>
BasicWebSite (3)
ConfigureAuthPolicies.cs (3)
15options.AddPolicy("Impossible", policy => 20options.AddPolicy("Api", policy => 25options.AddPolicy("Api-Manager", policy =>
CustomAuthorizationFailureResponse (3)
Startup.cs (3)
38options.AddPolicy(SamplePolicyNames.CustomPolicy, policy => 41options.AddPolicy(SamplePolicyNames.FailureReasonPolicy, policy => 44options.AddPolicy(SamplePolicyNames.CustomPolicyWithCustomForbiddenMessage, policy =>
JwtSample (1)
Startup.cs (1)
22options.AddPolicy(JwtBearerDefaults.AuthenticationScheme, policy =>
Microsoft.AspNetCore.Authorization (1)
AuthorizationBuilder.cs (1)
87Services.Configure<AuthorizationOptions>(o => o.AddPolicy(name, configurePolicy));
Microsoft.AspNetCore.Authorization.Test (23)
AuthorizationPolicyFacts.cs (3)
28options.AddPolicy("1", policy => policy.RequireClaim("1")); 29options.AddPolicy("2", policy => policy.RequireClaim("2")); 79options.AddPolicy("2", policy => policy.RequireClaim("2"));
DefaultAuthorizationServiceTests.cs (19)
515options.AddPolicy("Hao", policy => policy.RequireUserName("Hao")); 541options.AddPolicy("Hao", policy => policy.RequireUserName("Hao")); 563options.AddPolicy("Hao", policy => policy.RequireRole("Hao")); 585options.AddPolicy("Any", policy => policy.RequireAuthenticatedUser()); 610options.AddPolicy("Any", policy => policy.RequireAuthenticatedUser()); 643options.AddPolicy("Custom", policy => policy.Requirements.Add(new CustomRequirement())); 664options.AddPolicy("Custom", policy => policy.Requirements.Add(new CustomRequirement())); 705options.AddPolicy("Passthrough", policy => policy.Requirements.Add(new PassThroughRequirement(shouldSucceed))); 726options.AddPolicy("Combined", policy => policy.Combine(basePolicy).RequireClaim("Claim", "Exists")); 754options.AddPolicy("Combined", policy => policy.Combine(basePolicy).RequireClaim("Claim", "Exists")); 781options.AddPolicy("Combined", policy => policy.Combine(basePolicy).RequireClaim("Claim", "Exists")); 964options.AddPolicy("Basic", policy => policy.RequireAssertion(context => true)); 983options.AddPolicy("Basic", policy => policy.RequireAssertion(context => Task.FromResult(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))); 1201services.AddAuthorization(options => options.AddPolicy("Log", p => 1235services.AddAuthorization(options => options.AddPolicy("Log", p =>
PassThroughAuthorizationHandlerTests.cs (1)
35options.AddPolicy("Self", policy => policy.Requirements.Add(willFail));
Microsoft.AspNetCore.Mvc.Core.Test (2)
ApplicationModels\AuthorizationApplicationModelProviderTest.cs (2)
77options.Value.AddPolicy("Base", policy => policy.RequireClaim("Basic").RequireClaim("Basic2")); 78options.Value.AddPolicy("Derived", policy => policy.RequireClaim("Derived"));
Microsoft.AspNetCore.Mvc.RazorPages.Test (2)
ApplicationModels\AuthorizationPageApplicationModelProviderTest.cs (2)
111options.Value.AddPolicy("Base", policy => policy.RequireClaim("Basic").RequireClaim("Basic2")); 112options.Value.AddPolicy("Derived", policy => policy.RequireClaim("Derived"));
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (2)
Startup.cs (2)
38options.AddPolicy(JwtBearerDefaults.AuthenticationScheme, policy => 43options.AddPolicy(NegotiateDefaults.AuthenticationScheme, policy =>
Microsoft.AspNetCore.SignalR.Tests (4)
HubConnectionHandlerTests.cs (4)
2197options.AddPolicy("test", policy => 2233options.AddPolicy("test", policy => 2333options.AddPolicy("test", policy => 3730options.AddPolicy("test", policy =>
MinimalJwtBearerSample (1)
Program.cs (1)
14options.AddPolicy("is_admin", policy =>
SecurityWebSite (6)
StartupWithGlobalAuthFilter.cs (2)
23options.AddPolicy("RequireClaimA", policy => policy.RequireClaim("ClaimA")); 24options.AddPolicy("RequireClaimB", policy => policy.RequireClaim("ClaimB"));
StartupWithGlobalAuthFilterWithoutEndpointRouting.cs (2)
23options.AddPolicy("RequireClaimA", policy => policy.RequireClaim("ClaimA")); 24options.AddPolicy("RequireClaimB", policy => policy.RequireClaim("ClaimB"));
StartupWithGlobalDenyAnonymousFilterWithUseMvc.cs (2)
24options.AddPolicy("RequireClaimA", policy => policy.RequireClaim("ClaimA")); 25options.AddPolicy("RequireClaimB", policy => policy.RequireClaim("ClaimB"));
SignalR.Client.FunctionalTestApp (1)
Startup.cs (1)
49options.AddPolicy(JwtBearerDefaults.AuthenticationScheme, policy =>
StaticFilesAuth (1)
Startup.cs (1)
35options.AddPolicy("files", builder =>