gpt4 book ai didi

adfs - 带有 ADFS 4.0 的 Identityserver4,无法获取用户信息或声明

转载 作者:行者123 更新时间:2023-12-01 01:53:44 26 4
gpt4 key购买 nike

我试图将我的 Identityserver4 配置为使用 ADFS 4.0 作为外部提供程序。
我已将其配置如下:

            app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme
});

app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{

ClientId = "60b3d106-d155-4f9f-ba75-84b8078829fa",
AuthenticationScheme = "oidc",
PostLogoutRedirectUri = "http://localhost:5000",
DisplayName = "ADFS TEST Domain",
MetadataAddress = "https://srv2016dc01.test.local/adfs/.well-known/openid-configuration",
SaveTokens = true,
GetClaimsFromUserInfoEndpoint = true
});

似乎有效,因为我可以登录并获得一些 claim :
Claims get back from ADFS

但看起来 Userinfo 端点不会被调用......
否则应该会有更多声明,并且我在 ADFS 服务器的调试日志中看不到对 Userinfo 端点的调用。

我还尝试在代码中调用 Userinfo 端点,如此链接中所示:
ASP.NET Identity (with IdentityServer4) get external resource oauth access token

但是在“await _signInManager.UpdateExternalAuthenticationTokensAsync(info);”我没有取回 access_token,只有一个 id_token...

是否有人在使用 ADFS 4.0 或至少使用任何其他外部 OpenIdConnect 服务器的 Identityserver4 上有工作示例?

有没有其他方法可以从 Userinfo Endpoint 获取所有信息?

我需要从经过身份验证的用户那里获取组成员身份作为角色声明,以授予对 WebApi 资源的权限。

最佳答案

如果我在选项中将“token id_token”设置为 ResponseType 值,我将获得 token !
ResponseType = "代码 id_token"

如果 access_token 可用,则将调用 UserInfo 端点。

但是现在我会从 Userinfo 端点收到 401 错误。
无论如何......这个问题是通过添加解决的

ResponseType = "code id_token"

到 OpenIdConnectOptions

关于adfs - 带有 ADFS 4.0 的 Identityserver4,无法获取用户信息或声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42155823/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com