【发布时间】:2018-08-08 22:50:12
【问题描述】:
控制台应用程序试图获得发现
var disco = await DiscoveryClient.GetAsync("http://localhost:5000");
工作正常,但我试图弄清楚这件事是如何工作的,我似乎无法捕获 http 流量。
如果我使用http://localhost.fiddler 重定向到本地代理错误:
连接到 localhost.fiddler:5000/.well-known/openid-configuration 时出错:需要 HTTPS(未使用 HTTPS 设置,错误消息具有误导性!)
奇怪的是,当我们尝试使用
向 web-api 进行身份验证时,在代码的后面var response = await client.GetAsync("http://localhost.fiddler:5001/identity");
localhost.fiddler 工作正常,现在它在同一个 console.app 和 program.cs 中运行,所以在同一个文件中。这让我很生气,为什么我不能捕获到 5000 的流量,它是 HTTP !!!那么造成这种情况的原因是什么?还有其他方法可以查看进出 Identity Server 的神奇 http 流量吗?
添加启动类
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// configure identity server with in-memory stores, keys, clients and scopes
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients())
.AddTestUsers(Config.GetUsers());
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseIdentityServer();
}
}
添加了Blog,如果我们能解决这个问题,我们会更新并感谢。
【问题讨论】:
-
http://localhost.fiddler:5000首先呢? -
不工作不获取api
-
这到底是什么意思?它抛出异常?还是别的什么?
-
@saj 您的 IdentityServer 实现是否有登录屏幕?如果是这样,解决方案通常使用 MVC。
-
@aaronR,我的坏啊!发布了指向 API 而不是 Id 服务器的链接,现在应该是正确的链接 github.com/IdentityServer/IdentityServer4.Samples/blob/release/…
标签: c# asp.net-web-api fiddler identityserver4 openid-connect