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

Ber*_*sch 5 adfs openid-connect identityserver4

我试图将我的 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
            });
Run Code Online (Sandbox Code Playgroud)

似乎有效,因为我可以登录并获得一些声明: 声明从 ADFS 返回

但看起来 Userinfo Endpoint 不会被调用......否则应该有更多声明,而且我在 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 资源的权限。

Ber*_*sch 3

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

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

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

ResponseType = "code id_token"
Run Code Online (Sandbox Code Playgroud)

到 OpenIdConnectOptions