开发者

Azure ACS Popup or In Page Redirect, What's better?

开发者 https://www.devze.com 2023-04-07 05:14 出处:网络
What to get more opinion on something I\'m working on right now and what do you think is better in this situation.

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 开发者_StackOverflow社区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:

  1. User goes to my sign in page
  2. User hits Google or Facebook
  3. Popup open with the respective sign
  4. After you logs in, popup closes
  5. 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);
    });
});


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:

$(function() {
    window.opener.location.reload();
    self.close();
});

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消