我正在使用AuthorizeAttribute来装饰我的控制器操作.
[ServiceAuthorize(Roles="Editor,Publisher,Administrator")]
public JsonResult Create(NewsArticle newsArticle)
Run Code Online (Sandbox Code Playgroud)
我的NewsArticle模型中有一个字段,我想在AuthorizeAttribute中的OnAuthorize方法中使用.
有没有办法从AuthorizeAttribute的OnAuthorize方法中获取模型?
我认为它可以在AuthorizationContext中的某个地方使用,但我找不到它.我知道我可以在过滤器属性的ActionExecutingContext中找到它,但这意味着我需要在我的操作上使用另一个过滤器,我希望能够在一个步骤中执行所有授权.
谢谢.