How to protect all controllers by default with bearer token in ASP.NET Core?
<p>I have added a JWT middleware to my application:</p>
<pre><code>app.UseJwtBearerAuthentication(options =&gt; { options.AutomaticAuthenticate = true;} )
</code></pre>
<p>Ideally what I want to achieve is that all controller actions are protected by default (there were filters for that in previous ASP.NET), and I will put Anonymous on those that I want public or perhaps Authorize(&quot;SomePolicy&quot;) if I want additional policies, but I want that without a token the API cannot be accessed at all. How do I do this in the ASP.NET Core?</p>