Authorization

Authorization is the process where we verify whether the user has access to the requested resource. They might have legitimate access to the system, but they might not have access to the requested resource as they do not have the required access. For example, only the admin user can access the configuration page of the application, whereas normal users should not be allowed to use this page.

ASP.NET Identity provides several features for securing the application.

Let us consider the following simple scenario where the user tries to access the Secure Page, a page to which only authorized people should have access. As the user is not logged in, they will be redirected to the Login Page so that we can authenticate and authorize the user. Upon successful authentication, the user is redirected to the Secure Page. If for any reason, we can not authenticate and authorize the user, we can redirect them to the "Access denied" Page:

Authorization

ASP.NET Core Identity is a membership system that enables you to secure the application easily, and which has features such as adding login functionality to your application. The following are the steps that we need to follow in order to use ASP.NET Identity (with Entity Framework) for our application:

  1. Add the relevant dependencies to the project.json file.
  2. Create an appsettings.json file and store the database connection string.
  3. Create an ApplicationUser class and ApplicationDbContext class.
  4. Configure the application to use ASP.NET Identity.
  5. Create ViewModels for registration and login.
  6. Create the necessary controller and associated action methods and Views.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset