相关疑难解决方法(0)

验证对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));
Run Code Online (Sandbox Code Playgroud)

我有什么想法可以轻松地做到这一点?

authentication owin

14
推荐指数
1
解决办法
4962
查看次数

标签 统计

authentication ×1

owin ×1