IdentityServer4 提供了一个 OIDC 发现端点,可用于检索有关授权服务器的元数据,包括令牌端点。发现端点可通过 /.well-known/openid-configuration relative to the base address of your Token Server。例如,如果我们在本地运行应用程序并向以下端点执行 GET 请求:
https://localhost:44354/.well-known/openid-configuration
然后我们将看到以下 JSON 模式:
{
"issuer": "https://localhost:44354",
"jwks_uri": "https://localhost:44354/.well-known/openid-configuration/jwks",
"authorization_endpoint": "https://localhost:44354/connect/authorize",
"token_endpoint": "https://localhost:44354/connect/token",
"userinfo_endpoint": "https://localhost:44354/connect/userinfo",
"end_session_endpoint": "https://localhost:44354/connect/endsession",
// code omitted for brevity
}
基于“发现端点可通过 /.well-known/openid-configuration relative to the base address of your Token Server”条款,我想知道如何更改此端点的基地址。在 ASP.NET Core 应用程序中有可能吗?
不会帮助行动,但对其他人...
我不确定这是一种记录在案的方法,但这有效(放置before UseIdentityServer):
app.Use(async (ctx, next) =>
{
var serverUrls = ctx.RequestServices.GetRequiredService<IServerUrls>();
serverUrls.Origin = serverUrls.Origin = "https://yourneworigin;
await next();
});
app.UseIdentityServer();
在正确配置我们的反向代理之前,我将其用作临时解决方法。
对于那些因为反向代理问题而来到这里的人,Duende 有这个文档: https://docs.duendesoftware.com/identityserver/v6/deployment/proxies/
注意几个重要方面: