I have two authentication schemes in my app
services.AddAuthentication("default")
.AddJwtBearer("default", options =>
{
// some options
})
.AddJwtBearer("non-default", options =>
{
// some other options
});
The idea is to use the default for most of the controllers, and when the non-default is needed, to explicitly mention the needed schema with [Authorize(AuthenticationSchemes = "non-default")]. The problem is, the default schema is always being called, even when the non-default is set. It runs and fails, and after that the correct schema runs and succeeds. But this results in the log full of "Failed to validate the token" messages. Is there a way to disable the default schema?
I use net core 2.2, but considering to move to 3.1.