簡體   English   中英

Thinktecture IdentityServer退出后如何重定向?

[英]Thinktecture IdentityServer how do I redirect after sign out?

在我的依賴方應用程序(ASP.NET MVC4)中,我有一個Sign Out鏈接,它將我從IdentityServer中注銷。 我正在登陸它的“成功注銷”頁面,其中包含一個返回我的應用程序的鏈接。 我想要做的是點擊IdentityServer的“注銷”鏈接,然后只登陸我的本地視圖“LoggedOut”。 我怎么能做到這一點? 我確信這很常見,但我找不到任何編碼示例。 非常感謝您的幫助。 這是我的退出代碼......

public class LogoutHandler
{
    public string Signout()
    {
        FederationConfiguration cfg = FederatedAuthentication.FederationConfiguration;
        var fam = FederatedAuthentication.WSFederationAuthenticationModule;
        fam.SignOut(false);
        var signOutRequestMessage = new SignOutRequestMessage(new Uri(fam.Issuer), fam.Realm);

        return signOutRequestMessage.WriteQueryString();
    }
}

然后在控制器動作中,

public ActionResult Logout()
{
string signoutUrl = new LogoutHandler().Signout();
return new RedirectResult(signoutUrl);
}

這只是告訴我,但我登陸IdentityServer成功登出。

AFAIK您只需在thinktecture管理區域中指定重定向URL即可。 此外,您必須確保您的注銷頁面不安全。 如果沒有最后一部分,您將返回注銷頁面,但會立即重定向回STS。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM