簡體   English   中英

為什么在使用帶有ASP.Net Identity的ApplicationCookie之前調用SignOut(DefaultAuthenticationTypes.ExternalCookie)?

[英]Why call SignOut(DefaultAuthenticationTypes.ExternalCookie) before use of ApplicationCookie with ASP.Net Identity?

為什么這個示例在使用ApplicationCookie登錄之前調用SignOut for ExternalCookie? 它只是確保身份驗證信息干凈的一種方法嗎? (完整的例子在這里: http//www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity

private async Task SignInAsync(ApplicationUser user, bool isPersistent)
{
    AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);

    var identity = await UserManager.CreateIdentityAsync(
       user, DefaultAuthenticationTypes.ApplicationCookie);

    AuthenticationManager.SignIn(
       new AuthenticationProperties() { 
      IsPersistent = isPersistent 
       }, identity);
}

它基本上是清理,外部cookie應該最終被清除,它只需要存儲從google / fb / twitter等返回的聲明,這樣app可以在簽署用戶之前提取它需要的任何數據。 所以SignIn是一個清除外部數據的好地方。

暫無
暫無

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

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