Skills Expanded

Add Authentication to an Existing ASP.NET Core Wishlist Application

What you'll learn

In this project, you'll start with an ASP.NET Core wishlist application that only supports one user with one wishlist and no security and add in the ability to support multiple users with their own wishlists secured with basic authentication.

Table of contents

  • Set up your local environment for projects. We'll walk you through everything you need to know, including how to install and configure your environment to be able to complete all of the tasks.
Add Authentication Support
  • Configure the project so that authentication will be available throughout the application.
Create The AccountController
  • Create a controller named AccountController that will handle actions related to authentication.
Create Register Functionality
  • Create Views, View Models, and add action methods to the AccountController to add the ability to register an account.
Create Login Functionality
  • Fully implement the ability to login and logout of an already registered user account.
Update Home Index View
  • Update views to provide links to Login, Logout, and Register actions depending on if the user is logged in or not.
Create Relationship Between Item and ApplicationUser Models
  • Create a relationship between the `Item` and `ApplicationUser` models so operations on data happen for a single user's data.
Update ItemController Actions to Consider User
  • Update the ItemController and it's actions to use the logged in user information to allow individual users to have their own wishlists.

About the author

Eric is a software developer who is passionate about always learning and improving. When he's not writing code, you'll find him playing computer games, guitar, disc golf, or learning something new. He also takes time to speak at conferences, local user groups, and elementary and middle schools to promote education and self-improvement.

Ready to upskill? Get started