From a74ea4e6a8df9f6ea97403507d8aacc779a45bc9 Mon Sep 17 00:00:00 2001 From: souvik Date: Mon, 4 Dec 2023 18:05:06 +0530 Subject: [PATCH] fix: update the auth loc logic for httpAPiKey --- examples/slack-reaction-listener/asyncapi.yaml | 12 ++++++++++++ src/lib/wsHttpAuth.ts | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/slack-reaction-listener/asyncapi.yaml b/examples/slack-reaction-listener/asyncapi.yaml index c1694a43a..268e0aba6 100644 --- a/examples/slack-reaction-listener/asyncapi.yaml +++ b/examples/slack-reaction-listener/asyncapi.yaml @@ -9,6 +9,9 @@ servers: Slack_WebSocket: host: wss-primary.slack.com protocol: wss + security: + - $ref: '#/components/securitySchemes/app_id' + - $ref: '#/components/securitySchemes/ticket' Slack_HTTPS: host: slack.com protocol: https @@ -96,6 +99,15 @@ operations: - $ref: "#/components/messages/SlackReactionAdded" - $ref: "#/components/messages/GenericErrorPayload" components: + securitySchemes: + ticket: + type: httpApiKey + name: ticket + in: query + app_id: + type: httpApiKey + name: app_id + in: query messages: slackAckEvent: payload: diff --git a/src/lib/wsHttpAuth.ts b/src/lib/wsHttpAuth.ts index 7cd1cc0f2..e765bae43 100644 --- a/src/lib/wsHttpAuth.ts +++ b/src/lib/wsHttpAuth.ts @@ -99,11 +99,12 @@ class GleeAuth extends EventEmitter { } private httpApiKeyLogic(scheme, headers, query, authKey) { - const loc = scheme[String(authKey)].json('in') + + const loc = scheme.in() if (loc == 'header') { - headers[scheme[String(authKey)].json('name')] = this.auth[String(authKey)] + headers[scheme.name()] = this.auth[String(authKey)] } else if (loc == 'query') { - query[scheme[String(authKey)].json('name')] = this.auth[String(authKey)] + query[scheme.name()] = this.auth[String(authKey)] } return { headers, query }