14 Authentication: adding users to your application with Identity

This chapter covers

  • How authentication works in web apps in ASP.NET Core
  • Creating a project using the ASP.NET Core Identity system
  • Adding user functionality to an existing web app
  • Customizing the default ASP.NET Core Identity UI

One of the selling points of a web framework like ASP.NET Core is the ability to provide a dynamic app, customized to individual users. Many apps have the concept of an “account” with the service, which you can “sign in” to and get a different experience.

Depending on the service, an account gives you varying things: on some apps you may have to sign in to get access to additional features, on others you might see suggested articles. On an e-commerce app, you’d be able to make and view your past orders, on Stack Overflow you can post questions and answers, whereas on a news site you might get a customized experience based on previous articles you’ve viewed.

When you think about adding users to your application, you typically have two aspects to consider:

  • Authentication—The process of creating users and letting them log in to your app
  • Authorization—Customizing the experience and controlling what users can do, based on the current logged-in user

14.1  Introducing authentication and authorization

14.1.1    Understanding users and claims in ASP.NET Core

14.1.2    Authentication in ASP.NET Core: services and middleware

14.1.3    Authentication for APIs and distributed applications

14.2  What is ASP.NET Core Identity?

14.3  Creating a project that uses ASP.NET Core Identity

14.3.1    Creating the project from a template

14.3.2    Exploring the template in Solution Explorer

14.3.3    The ASP.NET Core Identity data model

14.3.4    Interacting with ASP.NET Core Identity

14.4  Adding ASP.NET Core Identity to an existing project

14.4.1    Configuring the ASP.NET Core Identity services and middleware

14.4.2    Updating the EF Core data model to support Identity

14.4.3    Updating the Razor views to link to the Identity UI

14.5  Customizing a page in ASP.NET Core Identity’s default UI

14.6  Managing users: adding custom data to users

14.7  Summary