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

查看:7
本文介绍了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 中被调用,这一定是新的.

解决方案

<块引用>

是的,它确实重定向到应用程序 - 我希望它重定向到不同的页面.

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

  1. Startup.cs中添加using System.Threading.Tasks;
  2. OnSignedOutCallbackRedirect 事件中配置您的新重定向网址:

    services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>{options.Authority = options.Authority + "/v2.0/";options.TokenValidationParameters.ValidateIssuer = false;options.Events.OnSignedOutCallbackRedirect = (上下文) =>{context.Response.Redirect("/Home/About");context.HandleResponse();返回Task.CompletedTask;};});

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.

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

  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天全站免登陆