【问题标题】:IdentityServer4 Correlation Failed Error with External ProviderIdentityServer4 与外部提供程序的关联失败错误
【发布时间】:2018-06-07 18:29:43
【问题描述】:

我正在尝试将 Ping Federate 集成为我的 IdentityServer4 实例的外部 OIDC 提供程序。当我启动外部登录流程时,出现以下错误:

System.Exception: Correlation failed.
   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.<HandleRequestAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IdentityServer4.Hosting.FederatedSignOut.AuthenticationRequestHandlerWrapper.<HandleRequestAsync>d__6.MoveNext() in C:\local\identity\server4\IdentityServer4\src\IdentityServer4\Hosting\FederatedSignOut\AuthenticationRequestHandlerWrapper.cs:line 38
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.<Invoke>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IdentityServer4.Hosting.BaseUrlMiddleware.<Invoke>d__3.MoveNext() in C:\local\identity\server4\IdentityServer4\src\IdentityServer4\Hosting\BaseUrlMiddleware.cs:line 43
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()

我有点困惑为什么FederatedSignOut 甚至被调用。关于我可能在这里遗漏的任何想法?

这是AddAuthentication的配置:

services.AddOidcStateDataFormatterCache();

services.AddAuthentication()
            .AddOpenIdConnect("ping", "Ping Federate", options =>
            {
                options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                options.SignOutScheme = IdentityServerConstants.SignoutScheme;

                options.Authority = "https://ping.domain.com/";
                options.ClientId = "IdentityServer4";
                options.ClientSecret = "IdentityServer4";

                options.TokenValidationParameters = new TokenValidationParameters
                {
                    NameClaimType = "name",
                    RoleClaimType = "role"
                };
            });

【问题讨论】:

  • 这方面有什么更新吗?我似乎遇到了完全相同的问题。我无法在开发环境中重现它,因为它可以正常工作。这只发生在生产环境中。
  • 我最终将 services.AddOidcStateDataFormatterCache(); 更改为 services.AddOidcStateDataFormatterCache("ping"); 并开始工作。

标签: identityserver4 pingfederate openid-connect


【解决方案1】:

在startup.cs的配置中添加这个。这是从 http 到 https 的问题。

app.UseForwardedHeaders(new ForwardedHeadersOptions
        {
            ForwardedHeaders = ForwardedHeaders.XForwardedProto
        });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-30
    • 2021-09-24
    • 2021-02-13
    • 1970-01-01
    • 2014-03-31
    • 2011-01-29
    • 2022-11-25
    相关资源
    最近更新 更多