This article describes how to disable authentication for ASP.NET Core 2.0.
ASP.NET Core JWT Authentication
I have some Rest API which I want to protect via JwtBearer token in production e.g.
public void ConfigureServices(IServiceCollection services)
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
o.Authority = authority;
o.Audience = audience;
o.RequireHttpsMetadata = false;
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
However in order to test the API, for development I totally want to disable authentication without having to remove all Authorizes in the Controllers.
This article demonstrates how the Hangfire dashboard can be set up in an ASP .NET 5 application including authentication via ASP .NET Identity.
Adding Hangfire Packages
Since I am using Hangfire with SQL, I have to add Hangfire itself and Hangfire.SqlServer to the project.json.
In my Angular2 application I want to be redirected to the login page whenever I get a 401 response during an Ajax call. Therefore I want to intercept all Ajax calls and check for the response code. In addition to that I also want to set a couple of default request headers for each Ajax call. The code below shows an interceptor for angular2 http requests.
In this article we will demonstrate how to provide authentication to ASP .NET 5 applications using ASP .NET Identity with Entity Framework 7.
Add the following package to your ASP .NET project. This will automatically pull in additional required dependencies for ASP .NET Identity.