Why isn't there an AuthenticationFilterAttribu

2019-07-18 15:06发布

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条回答
看我几分像从前
2楼-- · 2019-07-18 15:15

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

查看更多
登录 后发表回答