post_logout_redirect_uri ASP NET Core 2.2 AzureAD Razor类库RCL [英] post_logout_redirect_uri ASP NET Core 2.2 AzureAD Razor Class Library RCL

查看:124
本文介绍了post_logout_redirect_uri ASP NET Core 2.2 AzureAD Razor类库RCL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们尝试使用示例 https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/浏览了样本和所有作品.我们无法在注销过程后将其重定向.另外,似乎帐户控制器不存在,但在_layout.chtml中被调用,这一定是新的东西.

We have tried using the sample https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/ Walked through the sample and all works. We can't get it to redirect after logout process. Also, it seems the account controller is not there but it is called in _layout.chtml this must be something new.

推荐答案

是的,它确实重定向到了应用程序-我想要它执行的操作是重定向到另一个页面.

Yes, it does redirect to the application - what I'd like it to do is redirect to a different page.

您可以在退出后通过设置 OnSignedOutCallbackRedirect 事件将用户重定向到另一个页面:

You can redirect user to another page after sign-out by setting the OnSignedOutCallbackRedirect event :

  1. Startup.cs 中使用System.Threading.Tasks添加
  2. OnSignedOutCallbackRedirect 事件中配置新的重定向URL:

  1. In Startup.cs add using System.Threading.Tasks;
  2. Config your new redirect url in OnSignedOutCallbackRedirect event :

services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
{
    options.Authority = options.Authority + "/v2.0/";

    options.TokenValidationParameters.ValidateIssuer = false;

    options.Events.OnSignedOutCallbackRedirect = (context) =>
    {

        context.Response.Redirect("/Home/About");
        context.HandleResponse();

        return Task.CompletedTask;
    };
});

这篇关于post_logout_redirect_uri ASP NET Core 2.2 AzureAD Razor类库RCL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆