身份验证 – 向Microsoft.Owin.Testing.TestServer验证请求

我正在使用owin TestServer类单元测试我的web api.除了我不确定如何验证请求之外,它的工作非常好,所以我不能真正测试需要身份验证的端点,而不是确保未经身份验证的请求是未经授权的.

我正在将WebApi配置为仅使用承载令牌验证,如下所示:

// Web API configuration and services
// Configure Web API to use only bearer token authentication.
config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

任何想法,我怎么能这样容易吗

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...