What is ASP.NET IDENTITY

ASP.NET Identity is the new membership system for building ASP.NET web applications. ASP.NET Identity allows you to add login features to your application and makes it easy to customize data about the logged in user.

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);

}

The highlighted code above in the SignInAsync method generates a ClaimsIdentity. Since ASP.NET Identity and OWIN Cookie Authentication are claims-based system, the framework requires the app to generate a ClaimsIdentity for the user. ClaimsIdentity has information about all the claims for the user, such as what roles the user belongs to. You can also add more claims for the user at this stage.