为什么没有在的ASP.NET Web API 2的AuthenticationFilterAttribute类? [英] Why isn't there an AuthenticationFilterAttribute class in ASP.NET Web API 2?

查看:427
本文介绍了为什么没有在的ASP.NET Web API 2的AuthenticationFilterAttribute类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的ASP.NET Web API 2自带的 5家滤清器接口的:

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


  • IActionFilter

  • IAuthenticationFilter

  • 个IAuthorizationFilter

  • 个IExceptionFilter

  • IOverrideFilter

  • IActionFilter
  • IAuthenticationFilter
  • IAuthorizationFilter
  • IExceptionFilter
  • IOverrideFilter

所有这些接口都有内置的实现(如 ActionFilterAttribute AuthorizationFilterAttribute ),除了 IAuthenticationFilter 。是否有针对或有网页API的开发者根本忘了为特定接口的实现?

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?

更新

阅读伊沙伊Galatzer的回答后,我结束了实施失踪的属性,并将其上传到Nuget.org:的 https://www.nuget.org/packages/WebApi.AuthenticationFilter

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

推荐答案

由于我们不希望用户共同使用一个AuthenticationFilter。这不是把它前面和中心的一个方式。

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

这篇关于为什么没有在的ASP.NET Web API 2的AuthenticationFilterAttribute类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆