Asp.Net Identity RTM版本中的Microsoft.AspNet.Identity.Owin.AuthenticationManager在哪里?

Ola*_*ybø 7 asp.net asp.net-identity

我从这里安装了AspNet-identity组件的每晚构建

似乎AuthenticationManagerRC版本的类已从RTM版本(Microsoft.AspNet.Identity.Owin.1.0.0-rtm-130914)中消失.

它曾经在Microsoft.AspNet.Identity.Owin程序集中,但它不再存在.

这个类有方法:SignInAsync并且CheckPasswordAndSignInAsync在创建具有个人用户帐户身份验证的新ASP.Net Web应用程序MVC项目时获得的默认项目中使用.

AuthenticationManager现在在哪里?或者用什么代替?

Hao*_*ung 4

该类已经消失,因为它基本上只是添加生成 ClaimsIdentity 并将其传递到 Owin.Security.IAuthenticationManager 的方法。

相反,RTM 模板在控制器中有一个 SignIn 方法,如下所示:

    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);
    }
Run Code Online (Sandbox Code Playgroud)