Toggling Authentication in ASP.NET Core
Using configuration to enable or disable authentication on your ASP.NET Core app is easy
In production situations, you’ll definitely want to secure your ASP.NET Core API or Web App using an Identity and Access Control server, such as Thinktecture’s IdentityServer, or an authentication and authorisation provider like Auth0.