What is the difference between using AuthorizeAttribute or IAuthorizationFilter?

南楼画角 提交于 2019-12-05 03:43:06

IAuthorizationFilter is only an interface. It does nothing. If you wanted to use it, you'd have to implement your own authorization attribute that implements that interface from the ground up.

AuthorizeAttribute, on the other hand, works out of the box. It implements IAuthorizationFilter and already takes care of the common needs of developers. It still allows you to override the OnAuthorization method in case you want to extend its functionality, but you don't have to, as it works just fine without you doing that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!