Why isn't there an AuthenticationFilterAttribute class in ASP.NET Web API 2?

十年热恋 提交于 2019-12-11 01:39:53

问题


ASP.NET Web API 2 comes with five filter interfaces:

  • IActionFilter
  • IAuthenticationFilter
  • IAuthorizationFilter
  • IExceptionFilter
  • IOverrideFilter

All of those interfaces have built-in implementations (e.g. ActionFilterAttribute, AuthorizationFilterAttribute), except for IAuthenticationFilter. Is there a reason for that or have Web API devs simply forgot to provide an implementation for that particular interface?

UPDATE

After reading Yishai Galatzer's answer I ended up implementing the "missing" attribute and uploaded it to Nuget.org: https://www.nuget.org/packages/WebApi.AuthenticationFilter


回答1:


Because we don't expect the common user to use an AuthenticationFilter. This is a way of not putting it front and center.



来源:https://stackoverflow.com/questions/23554515/why-isnt-there-an-authenticationfilterattribute-class-in-asp-net-web-api-2

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