Browse Source

Adding use of the tenancy ID.

pull/4023/head
mike12345567 5 years ago
parent
commit
be6561e93d
  1. 4
      packages/auth/src/middleware/authenticated.js

4
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

Loading…
Cancel
Save