如何将自定义参数添加到Identity Server LogoutRequest?

问题描述

我有一个使用最新OpenIdConnect库的旧式ASP.NET MVC(Owin)网站,以及运行最新Identity Server软件包的.NET Core 3.1 MVC Identity Server应用程序。

我需要在注销时将自定义参数传递给Identity Server(用例是,我需要显示不同的“注销原因”消息,具体取决于在客户端上发起注销的方式)。因此,我通过OpenIdRequestType.logout截获了n.ProtocolMessage.SetParameter("some_key","SomeValue")设置自定义参数通知,并且可以看到Parameters字典中包含新值。但是,当logout发布到我的Identity Server中时,logoutRequest.Parameters集合为空。

                Notifications = new OpenIdConnectAuthenticationNotifications
                {
                    RedirectToIdentityProvider = async n =>
                    {
                        switch (n.ProtocolMessage.RequestType)
                        {
                            case OpenIdConnectRequestType.logout:
                                n.ProtocolMessage.SetParameter("some_key","SomeValue"); 
                                break;
    ...

我在身份服务器端打电话

            var logout = await _interaction.GetlogoutContextAsync(logoutId);

并发现logout.Parameters为空。

我发现this SO question暗示oidc-client javascript库可以处理添加显示logoutRequest对象中的其他参数,因此我猜测这是可能的,我只是缺少了一些东西简单。任何想法将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)