Blazor 6
我在页面上有两种类型的授权属性@attribute[授权(策略="IsAdmin"(]@attribute[Authorize(Roles="AdminRole,UserRole"(]
如何将Authorize属性的签入代码放在页面上并获取其类型(策略或角色(和值("IsAdmin"或"AdminRole,UserRole"(
protected override async Task OnInitializedAsync()
{
AuthorizeAttribute authorizeAttribute =
Attribute.GetCustomAttribute(this.GetType(),
typeof(AuthorizeAttribute)) as AuthorizeAttribute;
}