且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带有Corelation的Signin-oidc页面直接访问错误-如何重定向?

更新时间:2023-12-01 15:18:22

这在我之前也发生过,我认为这只是OpenId系统在ASP.NET Core中的工作方式的人工产物.我相信有一个Github问题,但我似乎找不到ATM.如果可以的话,我会四处看看并发布.

This happened to me previously as well, and I think this is just an artefact of how the OpenId system works in ASP.NET Core. I believe there was a Github issue for this but I can't seem to find it ATM. I'll have a look around and post it if I can find it.

在任何情况下,我都可以通过将事件添加到OpenId选项事件中来解决此问题,该事件仅重定向到首页"在任何远程故障上:

In any case, I was able to fix this by adding an event to the the OpenId options events that just redirects to "Home" on any remote failures:

options.Events = new OpenIdConnectEvents {
    // Your events here
    OnRemoteFailure = ctx => {
        ctx.HandleResponse();
        ctx.Response.Redirect("Home");
        return Task.FromResult(0);
    }
};

看看这是否适合您...

See if that works for you...

这是该问题和建议修复的注释,供您参考 https://github.com/IdentityServer/IdentityServer4/issues/720#issuecomment-368484827

This is the issue and comment with suggested fix for your reference https://github.com/IdentityServer/IdentityServer4/issues/720#issuecomment-368484827