Adding use of the tenancy ID.

This commit is contained in:
mike12345567 2021-07-23 17:41:00 +01:00
parent f86aa0ac78
commit 93f5419072
1 changed files with 4 additions and 0 deletions

View File

@ -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