Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

How to redirect to a custom page on WS Federation signout in MVC app #870

Open
moharmin opened this issue Dec 16, 2015 · 0 comments
Open

Comments

@moharmin
Copy link

I'm using IdentityServer2 with an MVC application I have the following action:

[Authorize]
public void SignOut()
{
var authModule = FederatedAuthentication.WSFederationAuthenticationModule;

    // clear local cookie
    authModule.SignOut();

    // initiate federated sign out request to the STS
    var signOutRequestMessage = new SignOutRequestMessage(new Uri(authModule.Issuer), authModule.Realm + "/account/message");

    var queryString = signOutRequestMessage.WriteQueryString();

    Response.Redirect(queryString);

}

What I am trying to do is get the identity server to redirect to my custom Thank You page (displayed by the Message action in the Account controller) after signing the user out. But it always redirects to its own sign out page.

I also tried the following to no avail:

[Authorize]
public void SignOut()
{
var fam = FederatedAuthentication.WSFederationAuthenticationModule;
var wrealm = string.Format("wtrealm={0}", fam.Realm);
var signOutUrl = WSFederationAuthenticationModule.GetFederationPassiveSignOutUrl(fam.Issuer, null, wrealm);
var wreply = "http://localhost/myapplication/account/message";
WSFederationAuthenticationModule.FederatedSignOut(new Uri(signOutUrl), new Uri(wreply));
}

Any help is greatly appreciated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant