0

私は現在、新しい ASPNET ID と Owin 認証を研究しているので、自分用にカスタマイズできます。デフォルトの MVC 5 アプリケーションを作成したところ、このコードに出くわしました

    private async Task SignInAsync(ApplicationUser user, bool isPersistent)
    {
        AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); /// WHY??
        var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
        AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
    }

質問

外部 Cookie を残すことによるセキュリティ上のリスクはありますか?

4

1 に答える 1

1

その行の目的は、サード パーティ プロバイダーから取得した外部 Cookie を無効にすることであることが判明しました。意図は、ユーザーのアイデンティティをサードパーティからローカルアイデンティティに転送することです。

そうしないと、ユーザーがサインアウトした後も Cookie が有効なままになります。

于 2014-07-24T10:54:51.657 に答える