private async Task InternalLoginAsync(HttpContextBase context, ApplicationUser user, bool isPersistent) { var authenticationManager = GetAuthenticationManager(context); authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var identity = await user.GenerateUserIdentityAsync(userManager, userRoles); authenticationManager.SignIn(new AuthenticationProperties { IsPersistent = isPersistent }, identity); }