I'm using the AutorizeView based on Roles in a blazor page to show/hide some features. But I need to do the same thing in the code behind. I don't know how to do it. In my particular case, If the logged user were admin it will see a complete list of Patients and, if it's not, it will see only the patients assigned to him.
<AuthorizeView Roles="Administrator" Context="search">
<Authorized>
random text
</Authorized>
</AuthorizeView>
I found this solution, but I don't use Policies. I'm just using Roles="Administrator".