17 references to AddPolicy
Microsoft.AspNetCore.Authorization.Test (17)
AuthorizationBuilderTests.cs (1)
95
.
AddPolicy
("name", p => p.RequireAssertion(_ => true));
DefaultAuthorizationServiceTests.cs (16)
40
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage")));
56
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy =>
76
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage", "CanViewAnything")));
103
services.AddAuthorizationBuilder().
AddPolicy
("Custom", policy => policy.Requirements.Add(new CustomRequirement()));
129
.
AddPolicy
("Custom", policy => policy.Requirements.Add(new CustomRequirement()))
181
services.AddAuthorizationBuilder().
AddPolicy
("Custom", policy => policy.Requirements.Add(new CustomRequirement()));
204
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage", "CanViewAnything")));
226
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage", "CanViewAnything")));
247
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage")));
268
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage")));
287
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage")));
301
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage")));
316
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireClaim("Permission", "CanViewPage")));
464
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => policy.RequireRole("Admin", "Users")));
483
services.AddAuthorizationBuilder().
AddPolicy
("Basic", policy => { })));
491
services.AddAuthorizationBuilder().
AddPolicy
("Hao", policy => policy.RequireUserName("Hao")));