【发布时间】:2017-12-01 08:39:21
【问题描述】:
这不是一个重复的问题,或者说其他解决方案中给出的解决方案没有奏效。
假设有一个控制器
[Authorize(Roles=//set dynamically)]
public IActionResult DashBoard(LoginModel model)
{
}
我已经尝试了以下问题的解决方案
-
dynamically add roles to authorize attribute for controller(错误:句柄方法 - 找不到合适的方法来覆盖)
所有这些解决方案都不起作用,因为接口中覆盖的方法不存在(例如,authorizeAttribute 不包含 AuthorizeCore 的定义),或者在某些情况下 IServiceCollection 服务不包含特定方法
【问题讨论】:
-
这里的答案真的是一个好...*.com/a/31465227/4755704
-
我已经试过了。未找到 AuthorizationContext 定义,对于句柄方法,它说没有找到合适的方法来覆盖
标签: asp.net asp.net-core asp.net-identity authorize-attribute role-based-access-control