问题描述
我们已经尝试使用示例https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/浏览了样本和所有作品.在注销过程后,我们无法让它重定向.此外,似乎帐户控制器不存在,但它在 _layout.chtml 中被调用,这一定是新的.
您可以通过设置 OnSignedOutCallbackRedirect
事件将用户重定向到另一个页面:
- 在
Startup.cs
中添加using System.Threading.Tasks;
在
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 samplehttps://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.
You can redirect user to another page after sign-out by setting the OnSignedOutCallbackRedirect
event :
- In
Startup.cs
addusing System.Threading.Tasks;
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!