In a blazor page, i want to (show/hide/set to read only/change style...etc) a text box if user has specific policy so to achieve (show and hide) i did the following:
<AuthorizeView Policy="CanReadNamePolicy">
<Authorized Context="test">
<inputText @Bind-Value="@Name"/>
</Authorized>
</AuthorizeView>
but the problem i have to repeat this for every policy, also what if same user is in multiple policies
So i thought of moving this logic to the code behind and use attributes to set the text box, but i couln't find a away to do the authorization check in the code behind
so i should have something like this
if ((await Authorize("PolicyName")).Succeeded)
{
ReadOnlyAttr = "readonly";
}
any idea if possible to perform the authorize check in code behind