31 references to RequireClaim
Aspire.Dashboard (1)
Authentication\OpenIdConnect\AuthorizationPolicyBuilderExtensions.cs (1)
31builder.RequireClaim(claimType, claimValue);
Microsoft.AspNetCore.Authorization.Test (26)
AuthorizationMiddlewareTests.cs (8)
547var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build(); 632var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewComment", "CanViewPage").Build(); 749.RequireClaim("Permission", "CanViewComment") 772var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").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();
DefaultAuthorizationServiceTests.cs (18)
40services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage"))); 59policy.RequireClaim("Permission", "CanViewPage"); 76services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage", "CanViewAnything"))); 204services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage", "CanViewAnything"))); 226services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage", "CanViewAnything"))); 247services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage"))); 268services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage"))); 287services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage"))); 301services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage"))); 316services.AddAuthorizationBuilder().AddPolicy("Basic", policy => policy.RequireClaim("Permission", "CanViewPage"))); 349.RequireClaim(ClaimTypes.Role, "User"); 442var policy = new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage"); 725var basePolicy = new AuthorizationPolicyBuilder().RequireClaim("Base", "Value").Build(); 726options.AddPolicy("Combined", policy => policy.Combine(basePolicy).RequireClaim("Claim", "Exists")); 753var basePolicy = new AuthorizationPolicyBuilder().RequireClaim("Base", "Value").Build(); 754options.AddPolicy("Combined", policy => policy.Combine(basePolicy).RequireClaim("Claim", "Exists")); 780var basePolicy = new AuthorizationPolicyBuilder().RequireClaim("Base", "Value").Build(); 781options.AddPolicy("Combined", policy => policy.Combine(basePolicy).RequireClaim("Claim", "Exists"));
Microsoft.AspNetCore.Mvc.Core.Test (3)
Authorization\AuthorizeFilterTest.cs (3)
146var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewPage").Build()); 221var authorizeFilter = new AuthorizeFilter(new AuthorizationPolicyBuilder().RequireClaim("Permission", "CanViewComment", "CanViewPage").Build()); 407.RequireClaim("Permission", "CanViewComment")
MinimalJwtBearerSample (1)
Program.cs (1)
17policy.RequireClaim("is_admin", "true");