【发布时间】:2021-01-06 17:18:44
【问题描述】:
我有一个 ASP.NET MVC 测试应用程序,它应该作为隐式 OIDC 客户端工作,具有来自 IdentityServer4 应用程序的访问和 id 令牌(两者都是 dotnet core 3.1)。 IdSvr 配置了几个外部 OIDC IdP:一个 KeyCloak 实例和一个 ADFS (4.0) 同上。
我的ADFS的IdSvr配置如下:
.AddOpenIdConnect("oidc_adfs", "ADFS", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.SignOutScheme = IdentityServerConstants.SignoutScheme;
options.SaveTokens = true;
options.Authority = "<<ADFS endpoint>>";
options.ClientId = "<<ADFS defined client id>>";
options.ClientSecret = "<<ADFS defined client secret>>";
options.Resource = "<<My resource identifier in ADFS>>";
options.TokenValidationParameters = new TokenValidationParameters
{
NameClaimType = "name",
RoleClaimType = "role"
};
options.ResponseType = "id_token";
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("openid");
options.Scope.Add("profile");
});
在 KeyCloak 案例中,一切正常 - 对 IdSvr 的“/signin-oidc”的回调请求正常,前通道用户代理在目标测试应用的后身份验证端点处结束,并且令牌可用。 当我使用 ADFS 时,用户在 ADFS 中通过身份验证后,流程停止并显示 HTTP 500,并且命中“/signin-oidc”端点,并且 IdSvr 日志显示:
CORS 请求路径:/signin-oidc from origin: > 但被忽略,因为路径不是 允许的 IdentityServer CORS 端点 2020-09-20 12:34:01.157 +02:00 [INF] 来自 RemoteAuthentication 的错误:无法取消保护 消息.状态..
我已经根据IdentityServer4 docs设置了CORS,所以问题可能是别的什么?
在检查 KeyCloak 和 ADFS 对“/signin-oicd”的回调请求的差异时,我可以看到 ADFS 确实将 Referer/Origin 添加到请求中,而 KeyCloak 没有。除此之外,这两个请求看起来非常相似。
希望有人能提供帮助。
【问题讨论】:
标签: identityserver4 openid-connect adfs4.0