Authentication in the blogging system

The authentication mechanism is the foundation required to support row-level security or multi-tenancy in the system, so we have to start building authentication in our application. There are various forms of authentication available, but we will be implementing cookie-based authentication in our blogging system.

The following code block will add cookie-based authentication as a service inside the ConfigureServices() method of Startup.cs:

    public void ConfigureServices(IServiceCollection services)    {       // Code removed for brevity      services.AddAuthentication(o =>      {        o.DefaultAuthenticateScheme =         CookieAuthenticationDefaults.AuthenticationScheme;        o.DefaultChallengeScheme =  CookieAuthenticationDefaults.AuthenticationScheme; ...

Get Mastering Entity Framework Core 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.