Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is Microsoft.AspNet.Identity.Owin.AuthenticationManager in Asp.Net Identity RTM version?

I have installed the nightly build of the AspNet-identity assemblies from here

It seems that the AuthenticationManager class from the RC version is gone from the RTM version (Microsoft.AspNet.Identity.Owin.1.0.0-rtm-130914).

It used to be in the Microsoft.AspNet.Identity.Owin assembly, but its no longer there.

This class had the methods: SignInAsync and CheckPasswordAndSignInAsync that are used in the default project you get when creating new ASP.Net web application MVC project with Individual User Account authentication.

Where is the AuthenticationManager now? Or what to use instead?

like image 239
Olav Nybø Avatar asked Sep 14 '13 11:09

Olav Nybø


1 Answers

That class is gone, as it was basically just adding methods that generated a ClaimsIdentity and passed that into an Owin.Security.IAuthenticationManager.

Instead the RTM templates have a SignIn method in the controller that looks something like this:

    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);
    }
like image 134
Hao Kung Avatar answered Sep 18 '22 14:09

Hao Kung