From the course: Security in ASP.NET Core

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Adding password hashing to the app

Adding password hashing to the app - ASP.NET Tutorial

From the course: Security in ASP.NET Core

Adding password hashing to the app

- I have prepared a Helper class. Password helper, which essentially has two methods. Hash Password, takes a password, and then creates a hash and a salt. I'm using a new record. I created Hash Information and Hash Information, well, contains a hash and a salt, so super easy. And then we have Verify Password. Verify password expects a password and compares it against a hash. So essentially, if the application receives a password, it checks whether that password matches the hash that we have stored somewhere in our application. You may now wonder, wait a minute, don't we have to change the model for our user with the hash and the salt? Well, turns out we don't have to because salt and hash have been there from the very beginning, but we still have an issue here and we'll see that in a minute. First, let's go to the Model Builder Extensions file where we are seeding the application and you see that, now, we are not storing the passwords in the database any longer, but we create the…

Contents