Skip to content

Commit

Permalink
fix: update the auth loc logic for httpAPiKey
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns committed Dec 4, 2023
1 parent eb29fed commit a74ea4e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions examples/slack-reaction-listener/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions src/lib/wsHttpAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit a74ea4e

Please sign in to comment.