From the course: Learning ASP.NET Core MVC
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Add identity services to your application
From the course: Learning ASP.NET Core MVC
Add identity services to your application
- Now that I've secured my controller actions by placing the authorize attribute on them, I'll show you how to use Microsoft's identity services to allow users to register for an account on your site and then log in in order to access these secured controller actions. There are several steps to configuring a working identity services solution, but the first step is to register the middleware with a call to app.UseIdentity. Notice how I'm registering this middleware before the NVC middleware so that it has a chance to get authorized before NVC gets ahold of it. When visual studio shows you the error, go ahead and pull in this package. Next, I'll need to configure the dependencies that identity services need. This will get a bit complex but it starts simply enough with a call to services.AddIdentity of T. This call requires two generic type parameters. The first parameter is the type that will contain all of the user's information: username, email, password, etcetera. We could create…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.