I did it in my rc1 project like:
User.Claims.ElementAt(#).Value
But after I switched to rtm it wouldn’t work anymore. When I debug the Razo
In Core 3.0, use view authorization
Startup.cs
services.AddAuthorization(options =>
{
options.AddPolicy("Claim_Name", x => x.RequireClaim("Claim_Name"));
});
Then inside the UI
if ((AuthorizationService.AuthorizeAsync(User, "Claim_Name")).Result.Succeeded){
//show ui element
}
View-based authorization in ASP.NET Core MVC