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