Adding ASP.NET MVC5 Identity Authentication to an existing project

I have seen lots of similar pages on the web, but most of them use a new project instead of an existing one, or don’t have the necessary features. So, I have an existing MVC 5 project and want to integrate ASP.NET MVC5 Identity with log in, email confirmation and password reset features. In addition … Read more

ASP.NET Identity’s default Password Hasher – How does it work and is it secure?

I am wondering wether the Password Hasher that is default implemented in the UserManager that comes with MVC 5 and ASP.NET Identity Framework, is secure enough? And if so, if you could explain to me how it works? IPasswordHasher interface looks like this: public interface IPasswordHasher { string HashPassword(string password); PasswordVerificationResult VerifyHashedPassword(string hashedPassword, string providedPassword); … Read more

What is ASP.NET Identity’s IUserSecurityStampStore interface?

Looking at ASP.NET Identity (new membership implementation in ASP.NET), I came across this interface when implementing my own UserStore: //Microsoft.AspNet.Identity.Core.dll namespace Microsoft.AspNet.Identity { public interface IUserSecurityStampStore<TUser> : { // Methods Task<string> GetSecurityStampAsync(TUser user); Task SetSecurityStampAsync(TUser user, string stamp); } } IUserSecurityStampStore is implemented by the default EntityFramework.UserStore<TUser> which essentially get and set the TUser.SecurityStamp property. … Read more

ASP.NET Identity DbContext confusion

A default MVC 5 App comes with this piece of code in IdentityModels.cs – this piece of code is for all the ASP.NET Identity operations for the default templates: public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base(“DefaultConnection”) { } } If I scaffold a new controller using views with Entity Framework and create … Read more

What is the claims in ASP .NET Identity

Can somebody please explain, what the claim mechanism means in new ASP.NET Identity Core? As I can see, there is an AspNetUserLogins table, which contains UserId, LoginProvider and ProviderKey. But, I still can’t understand or find any information on when data is added to the AspNetUserClaims table and what situations this table is used for? … Read more

Where are the Login and Register pages in an AspNet Core scaffolded app?

In VS 2017, I created a new ASP.NET Core Web Application. On the second page of the wizard, I chose Web Application, and for Authentication, I chose “Individual User Accounts”. Now, I’m trying to find the Pages associated with /Account/Register and /Account/Login. _Layout.cshtml brings in _LoginPartial.cshtml, much as it did in classic MVC: <div class=”navbar-collapse … Read more

How can I change the table names when using ASP.NET Identity?

I am using the release version (RTM, not RC) of Visual Studio 2013 (downloaded from MSDN 2013-10-18) and therefore the latest (RTM) version of AspNet.Identity. When I create a new web project, I select “Individual User Accounts” for authentication. This creates the following tables: AspNetRoles AspNetUserClaims AspNetUserLogins AspNetUserRoles AspNetUsers When I register a new user … Read more

ASP.NET MVC 5 – Identity. How to get current ApplicationUser

I have an Article entity in my project which has the ApplicationUser property named Author. How can I get the full object of currently logged ApplicationUser? While creating a new article, I have to set the Author property in Article to the current ApplicationUser. In the old Membership mechanism it was simple, but in the … Read more