如何在OnTicketReceived期间重定向

如何在OnTicketReceived期间重定向

本文介绍了如何在OnTicketReceived期间重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的OIDC流程中,我有这种方法...

In our OIDC flow I have this method...

    options.Events.OnTicketReceived = async context =>
    {
      ...
        (bool doRedirect, string destUrl) = redirectHelper.ProcessRedirectionRules(user);
        if (doRedirect)
        {
          context.Response.Redirect(destUrl);
          return;
        }

      ...
    };

不幸的是,尽管我确实需要将用户重定向到目标URL,但 context.Response.Redirect(destUrl); 根本不执行重定向.

Unfortunately, though I really need to redirect the user to a destination URL, the context.Response.Redirect(destUrl); does not perform a redirection at all.

我是要在错误的位置还是以错误的方式重定向?应该怎么做?

Am I attempting to redirect in the wrong place or in the wrong way? How should this be done?

推荐答案

我认为您缺少此功能:

if (doRedirect)
{
  context.Response.Redirect(destUrl);
  context.HandleResponse();
  return;
}

摘要:停止对此请求的所有处理,然后返回到客户端.调用方负责生成完整的响应.

Summary:Discontinue all processing for this request and return to the client. The caller is responsible for generating the full response.

这篇关于如何在OnTicketReceived期间重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 12:27