.NET Core Authorize attribute with external JWT authentication microservice?
<p>So I'm just having a bit of trouble getting my head round the .NET Core [Authorize] attribute.</p>

<p>I have an authentication service running (let's say <code>authapi.com</code>) which when provided with valid authentication details will return a JWT.  When this JWT is given back to it, it will validate the JWT and return a message indicating such.</p>

<p>So, I'm now building another WebAPI (let's say <code>genericapi.com</code>)which will require authorization for some of the actions/controllers.  The idea being, the JWT will be passed in the headers of the request to <code>genericapi</code> which then needs to pass those on to <code>authapi.com</code> to validate them.</p>

<p>I tried adding a Policy but it got convoluted really quick, and I had to write <code>[Authorize(Policy="TokenValid")]</code> on everything, when I'd rather just the default <code>[Authorize]</code> did this, since ALL authorization will have to hit <code>authapi</code>.</p>

<p>How would I go about getting that JWT from the header and passing it to the <code>authapi</code> as standard behaviour for <code>[Authorize]</code>?</p>

<p>Bear in mind: I don't want to do anything with the JWTs on <code>genericapi</code>, all authentication is to be handled by <code>authapi</code>.</p>