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;
})
.AddCookie();
}
The configuration required...