Any way to use Authorization Policies in a view in .NET Core 1.0 MVC?
I know in controllers, you can write [Authorize("policyName")] without an issue, but is there any way to use a policy in a view? I'd rather not use User.IsInRole(...) every single time I want to authorize some HTML. Edit: Here's some code Startup.cs -- Policy Declaration services.AddAuthorization(options => { options.AddPolicy("testPolicy", policy => { policy.RequireAuthenticatedUser() .RequireRole("RoleOne", "RoleTwo", "RoleThree") .RequireClaim(ClaimTypes.Email); }); }); Admin Controller [Authorize("testPolicy")] public class AdminController : Controller { public IActionResult Index() {