From be6561e93dddcb7619f1530e22e1bd396db4262a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 23 Jul 2021 17:41:00 +0100 Subject: [PATCH] Adding use of the tenancy ID. --- packages/auth/src/middleware/authenticated.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/auth/src/middleware/authenticated.js b/packages/auth/src/middleware/authenticated.js index e8fbb56fb0..c79725233f 100644 --- a/packages/auth/src/middleware/authenticated.js +++ b/packages/auth/src/middleware/authenticated.js @@ -75,11 +75,15 @@ module.exports = (noAuthPatterns = [], opts) => { } } const apiKey = ctx.request.headers[Headers.API_KEY] + const tenantId = ctx.request.headers[Headers.TENANT_ID] // this is an internal request, no user made it if (!authenticated && apiKey && apiKey === env.INTERNAL_API_KEY) { authenticated = true internal = true } + if (!user && tenantId) { + user = { tenantId } + } // be explicit if (authenticated !== true) { authenticated = false