身份服务器3 MVC客户端状态参数 [英] Identity server 3 MVC client state parameter

查看:93
本文介绍了身份服务器3 MVC客户端状态参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过Identity Server 3连接的asp.net MVC/Angular应用程序.

I have asp.net MVC / angular application which connects through Identity Server 3.

我想要实现的是让IS3在登录后将我重定向到Angular路径.

What I want to achieve is for the IS3 to redirect me to the Angular path after login.

在重定向到IS3之前我已经获得了角度相对路径,我需要做的是将该路径发送到IS3,并在登录后将其发送回我,以便我可以将其附加到重定向Uri.

I already get the angular relative path before redirecting to IS3, what I need to do is to send that path to IS3 and have it send it back to me after login so that I can attach it to the redirect Uri.

在尝试重定向到IS3时,我尝试将其添加到状态"参数中,但这会导致无效的重定向.该参数已经有一个值,如果我更改它,重定向就会中断

I've tried adding it to the "state" parameter when redirecting to IS3, but that results in an invalid redirect. That parameter already has a value and if I change it, the redirect breaks

我有什么办法可以将该信息发送给is3,然后在登录后将其取回?

Is there any way for me to send that info to is3 and then get it back after login ?

谢谢

推荐答案

实现此目标的最佳方法是在应用程序中存储有关登录后所需重定向路径的状态.在IdSvr登录用户并重定向回您的一个众所周知的回调URI之后,您将读取该状态以了解将用户发送到何处. IOW,在您的应用程序中跟踪它.

The best way to achieve this is to store state in your app about the redirect path you want after login. After IdSvr logs your user in and redirect back to your one well-known callback URI you then read that state to know where to send the user. IOW, keep track of that in your app.

通过将对应用程序的回调限制在一个众所周知的URL中,我们试图防止开放重定向攻击.

By restricting your callback into your app to a single well-known URL we're trying to prevent open redirect attacks.

这篇关于身份服务器3 MVC客户端状态参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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