簡體   English   中英

所有應用程序的Azure AD B2C注銷

[英]Azure AD B2C logout from all apps

我已經使用Azure AD為wordpress和Jira設置了2個saml應用程序。 我被要求按照以下流程設置應用程序:1.用戶從WordPress網站注銷2.用戶從Azure AD注銷3.破壞與其他單個應用程序的會話,這些應用程序與活動用戶會話具有單點登錄功能可能是JIRA和其他應用程序)。

我已經完成了前兩個步驟,但在第三個步驟中卻苦苦掙扎。 Azure技術支持團隊表示,他們提供了在注銷時銷毀所有應用程序會話的功能,但是我找不到有關如何進行設置的任何文檔。

任何幫助,將不勝感激。 謝謝。

如果要銷毀所有應用程序的用戶會話,則可能需要使用會話管理 這意味着使用ADAL方法正確注銷。 如果應用程序依賴於Azure AD發出的訪問令牌,則應該調用注銷事件處理程序。

范例(C#)

HttpContext.GetOwinContext().Authentication.SignOut(OpenIdConnectAuthenticationDefaults.AuthenticationType, CookieAuthenticationDefaults.AuthenticationType)

它還應該通過調用Session.Abandon()方法來破壞用戶的會話。 以下方法顯示了用戶注銷的安全實現:

[HttpPost]
[ValidateAntiForgeryToken]
public void LogOff()
{
    string userObjectID = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;
    AuthenticationContext authContext = new AuthenticationContext(Authority + TenantId, new NaiveSessionCache(userObjectID));
    authContext.TokenCache.Clear();
    Session.Clear();
    Session.Abandon();
    Response.SetCookie(new HttpCookie("ASP.NET_SessionId", string.Empty));
    HttpContext.GetOwinContext().Authentication.SignOut(
        OpenIdConnectAuthenticationDefaults.AuthenticationType,
        CookieAuthenticationDefaults.AuthenticationType);
}

請參閱本文檔中有關Seesion Management的更多詳細信息。

請參閱本文檔中有關ADAL的更多詳細信息。

暫無
暫無

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

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