IdentityServer3将注销重定向到自定义URL

编程入门 行业动态 更新时间:2024-10-21 03:49:09
本文介绍了IdentityServer3将注销重定向到自定义URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在google中搜索,并且Stack Overflow没有合适的答案.

I searched in google and Stack Overflow there is no appropriate answer is available.

我在客户端应用程序中使用ReactJs + Redux,.Net WebAPI用于联系数据库和其他逻辑实现,最后我使用IdentityServer3对用户进行身份验证.

I'm using ReactJs + Redux in the Client Application, .Net WebAPI is used for contacting the Database and other logical implementation and Finally I'm using IdentityServer3 for authenticating the User.

点击退出后,我将触发以下URL: localhost:123/核心/连接/结束会话

Once I hit the Logout I'm triggering the following URL : localhost:123/core/connect/endsession

new Client { Enabled = true, ClientName = "Super Star Application", ClientId = "SS", Flow = Flows.Implicit, RequireConsent = false, RequireSignOutPrompt =false, RedirectUris = new List<string> { "localhost:111/callback" }, PostLogoutRedirectUris = new List<string> {"www.google/"}, AllowedCorsOrigins = new List<string> { "localhost:111/" }, AllowAccessToAllScopes=true }

在Startup.cs中,我有以下代码

In Startup.cs I'm having the following code

app.Map("/core", core => { var idSvrFactory = Factory.Configure(); idSvrFactory.ConfigureUserService("AspId"); var options = new IdentityServerOptions { SiteName = "Super Star", SigningCertificate = Certificate.Get(), Factory = idSvrFactory, ProtocolLogoutUrls = new System.Collections.Generic.List<string>() { "www.google.co.in" }, AuthenticationOptions = new AuthenticationOptions { EnablePostSignOutAutoRedirect=true, EnableSignOutPrompt = false, PostSignOutAutoRedirectDelay = 1, EnableLoginHint = true, RememberLastUsername = true, EnableAutoCallbackForFederatedSignout = true, RequireSignOutPrompt = false } }; core.UseIdentityServer(options); });

我不知道如何重定向到 www.google 而不是重定向到以下屏幕

I don't know how to redirect to www.google instead of the following screen

请帮助我...

推荐答案

您需要调用endsession端点,传递id令牌并以注销后的重定向URL作为参数.

You need to call the endsession endpoint, passing the id token and post logout redirect url as arguments.

/connect/endsession?id_token_hint={id token}&post_logout_redirect_uri=www.google

其中{id token}是调用/connect/authorize端点时从身份服务器返回的id令牌.

where {id token} is the id token returned from identity server when calling the /connect/authorize endpoint.

在此处查看文档 identityserver.github.io/Documentation /docsv2/endpoints/endSession.html

请注意,您必须发送回一个ID令牌才能使重定向正常工作,否则结束会话请求的验证将失败并且不会发生重定向.

Note that you MUST send an id token back for the redirect to work, else the validation of the endsession request will fail and no redirect will occur.

更多推荐

IdentityServer3将注销重定向到自定义URL

本文发布于:2023-11-17 02:02:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608399.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   重定向   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!