Can Policy Based Authorization be more dynamic?

后端 未结 2 889
隐瞒了意图╮
隐瞒了意图╮ 2020-12-09 09:55

Net Core policy authorization, however it is looking very static to me. Because in the Enterprise Application, there is an often need for new roles which will need new poli

2条回答
  •  萌比男神i
    2020-12-09 10:18

    The accepted answer is still quite limiting. It doesn't allow for dynamic values at the Controller and Action level. The only place a custom value could be added is in the requirement when the policy is added. Sometimes you need more fine grain control over the authorization process. A very common scenario is permission based security. Each controller and action should be able to specify the permissions required to access them. See my answer here for a more powerful solution that lets you use custom attributes to decorate your controllers and actions with any information you need while doing authorization.

提交回复
热议问题