after federated authentication, redirect to originally requested url

丶灬走出姿态 提交于 2019-12-10 10:04:16

问题


We've setup federated security using ThinkTecture server.

When a user wishes to access a particular URL, they get redirected to the Identity Provider Server (IDP), they login, get authenticated.

Then, the IDP server will redirect the user back to the "Redirect URL" specified in the configuration for that Relying Party.

Instead, I want it to be redirected to the originally requested URL.

Is this possible? I've read a little about the wreply parameter, but not sure how I use this and intercept the authentication levels calls on the original web server, before the redirect.

Update I've realised that my problem is due to my url containing a hash, e.g. http://domain.com/#customer/123 and nothing after the hash is passed into the redirect url within WIF. See my answer below for more details.


回答1:


It's up to your app to remember context info like this in the wctx param. If you're using WIF in the RP then this should be done automatically.




回答2:


I figured out what was happening. I am using WIF and as Brock's answer suggested it should be doing everything itself...and it was.

Normally if you request a url like: http://domain.com/page and the 'Redirect To'/ReplyTo setting in ThinkTecture is just http://domain.com/.

Then when WIF calls out to the STS, it takes the path of the requested domain, in this case /path and adds it to the &ru param within the &wctx param. The &wctx param will look like this: rm=0&id=passive&ru=%2fpage.

Then after the STS has authenticated it redirects the user back to the ReplyTo url, http://domain.com with a body parameter of wctx and WIF picks this up and uses the ru param to do another redirect.

The problem is that my requested url was http://domain.com/#page and WIF doesn't include the #page in the ru param. So my ru param was just /, so it kept redirecting to http://domain.com which there was correct (yet incorrect).

Guess I need to set the ru value myself with the full URL... unless there is a better way.



来源:https://stackoverflow.com/questions/17408711/after-federated-authentication-redirect-to-originally-requested-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!