From 38125f6cd6b97aed2d947592e236e681c91746f9 Mon Sep 17 00:00:00 2001 From: Johannes Vogel Date: Tue, 12 Nov 2024 15:05:51 +0100 Subject: [PATCH] Revert ". (#14)" This reverts commit 28fa61bfcc1bed7f2991da846e5260da22b23cda. --- cds-plugin.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cds-plugin.js b/cds-plugin.js index b65b046..3632f2e 100644 --- a/cds-plugin.js +++ b/cds-plugin.js @@ -135,8 +135,6 @@ class EventBroker extends cds.MessagingService { this.auth = {} // { kind: 'cert', validationCert?, privateKey? } or { kind: 'ias', ias } - console.log('cds.env.requires:', cds.env.requires) - // determine auth.kind if (this.options.x509) { if (!this.options.x509.cert && !this.options.x509.certPath) @@ -157,8 +155,6 @@ class EventBroker extends cds.MessagingService { } else this.auth.kind = 'cert' } - console.log('this.auth:', this.auth) - if (!this.auth.kind || (this.auth.kind === 'ias' && !this.auth.ias)) throw new Error(`${this.name}: Event Broker requires your app to be bound to an IAS instance.`) @@ -335,6 +331,7 @@ class EventBroker extends cds.MessagingService { Object.assign(msg.headers, headers) if (this.isMultitenancy) msg.tenant = tenant + // for cds.context.http msg._ = {} msg._.req = req msg._.res = res @@ -342,12 +339,7 @@ class EventBroker extends cds.MessagingService { const context = { user: cds.User.privileged, _: msg._ } if (msg.tenant) context.tenant = msg.tenant - - await this.tx(context, tx => { - if (cds.context.http?.req?.headers?.authorization) delete cds.context.http.req.headers.authorization // potential destination lookup fails if IAS token is used - return tx.emit(msg) - }) - + await this.tx(context, tx => tx.emit(msg)) this.LOG.debug('Event processed successfully.') return res.status(200).json({ message: 'OK' }) } catch (e) {