IdentityServer2 icon indicating copy to clipboard operation
IdentityServer2 copied to clipboard

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

Open moharmin opened this issue 9 years ago • 0 comments

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.

moharmin avatar Dec 16 '15 16:12 moharmin