Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 957
Michael Benford Avatar asked Nov 22 '25 08:11

Michael Benford


1 Answers

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

like image 154
Yishai Galatzer Avatar answered Nov 25 '25 00:11

Yishai Galatzer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!