Azure ACS 弹出窗口或页面内重定向,哪个更好?
对于我现在正在做的事情,如何获得更多意见以及您认为在这种情况下什么更好。
现在我正在使用 Azure ACS 构建登录,我想知道哪个更好。
选项 1 当用户单击他们想要使用的登录名时,它将打开一个弹出窗口,然后他们可以在那里登录。但我无法关闭该弹出窗口。他们登录后,我希望关闭弹出窗口并从他们所在的选项卡重定向到不同的页面,但我不确定 ACS 是否可以做到这一点。
选项 2 有页面内重定向,但这会使用户离开网站,这是我真的不想做的事情。
有没有办法让选项 1 按照我希望的方式与 Azure ACS 配合使用? 如:
- 用户进入我的登录页面
- 用户点击 Google 或 Facebook
- 弹出窗口,并使用相应的标志打开
- 登录后,弹出窗口关闭
- 选项卡用户所在位置将重定向到用户页面,并且我仍然可以在该视图中使用 FormCollection 对象。
这是我正在使用的js。
$(function () {
$(".signup a").click(function () {
var sizes = ["width=850,height=500"];
var url = $(this).attr("class");
var name = "popUp";
var size = sizes[0];
window.open(url, name, size);
});
});
What to get more opinion on something I'm working on right now and what do you think is better in this situation.
Right now I'm building a login using the Azure ACS, and I wanted to know which would be better.
Option 1
When a user clicks the login they want to use it will open a popup window, and then they can login in there. But I can't close that popup window. Once they logged in I was hoping to close the popup and redirect to a different page from the tab they are on, but I'm not sure if that's possible with ACS.
Option 2
There's the in page redirect but that takes the user away from the site, and it's something I really didn't wanna do.
Is there a way to get option 1 to work the way I want it to work with Azure ACS?
As in:
- User goes to my sign in page
- User hits Google or Facebook
- Popup open with the respective sign
- After you logs in, popup closes
- Tab user is on is redirect to user page, and I still have the FormCollection Object to use in that view.
Here's the js I'm using.
$(function () {
$(".signup a").click(function () {
var sizes = ["width=850,height=500"];
var url = $(this).attr("class");
var name = "popUp";
var size = sizes[0];
window.open(url, name, size);
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 ACS 依赖方配置中,您有“返回 URL”配置。 ACS 将在该 URL 中发布您的安全令牌。或者换句话说,用户使用身份提供商登录后的最终重定向位置。
因此,您需要做的是将返回 URL 设置为如下所示: https://mysite/loggedin
并在登录页面中/view 重新加载打开此页面的页面并关闭此页面:
一旦 ACS 重定向到您的站点,WSFam 将通过 WSSam 创建 WS Fed 会话 cookie,一旦您重新加载您的开启页面,您的页面将使用 WS Fed cookie 加载哪个意味着您将拥有登录用户。
In your ACS Relying Party configuration you have "Return URL" configuration. This URL is where ACS will post your security token. Or in other words the final redirect location once the user logs in with an identity provider.
So what you need to do is set the Return URL to something like: https://mysite/loggedin
And in the loggedin page/view reload the page which opened this page and close this page:
Once the ACS redirects to your site WSFam will create via WSSam the WS Fed session cookie, and once you reload your opener page, your page will be loaded with the WS Fed cookie which means you will have the logged in user.