Identity server 3 MVC client state parameter

2019-09-12 06:45发布

问题:

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

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

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.

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

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

Thanks

回答1:

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.

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