IdentityServer / IdentityServer2

[deprecated] Thinktecture IdentityServer is a light-weight security token service built with .NET 4.5, MVC 4, Web API and WCF.
Other
410 stars 291 forks source link

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

Open moharmin opened 8 years ago

moharmin commented 8 years ago

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.