Skip to content

Commit

Permalink
fix: security
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns committed Sep 29, 2023
1 parent 1181316 commit e1c12f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/adapters/mqtt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ class MqttAdapter extends Adapter {

const securityRequirements = this.AsyncAPIServer.security().map(e => e.map(e => e.scheme()))

securityRequirements.forEach(sec => {
for (const security of sec) {
if(security.type() === 'userPassword') {
userAndPasswordSecurityReq = security
securityRequirements.forEach(security => {
for (const sec of security) {
if(sec.type() === 'userPassword') {
userAndPasswordSecurityReq = sec
}

if (security.type() === 'x509') {
X509SecurityReq = security
if (sec.type() === 'x509') {
X509SecurityReq = sec
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/ws/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class WsClientAdapter extends Adapter {
const channels = []
for (const channel of this.channelNames) {
if (this.parsedAsyncAPI.channels().get(channel).bindings().get('ws')) {
if (this.parsedAsyncAPI.channels().get(channel).servers().length !== 0) { // NOSONAR
if (this.parsedAsyncAPI.channels().get(channel).servers().all().length !== 0) { // NOSONAR
if (
this.parsedAsyncAPI
.channels().get(channel)
Expand Down
6 changes: 6 additions & 0 deletions src/lib/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class GleeAdapter extends EventEmitter {
private _AsyncAPIServer: Server
private _parsedAsyncAPI: AsyncAPIDocument
private _channelNames: string[]
private _channelAddresses: string[]
private _connections: GleeConnection[]
private _serverUrlExpanded: string

Expand All @@ -52,6 +53,7 @@ class GleeAdapter extends EventEmitter {

this._parsedAsyncAPI = parsedAsyncAPI
this._channelNames = this._parsedAsyncAPI.channels().all().map(e => e.address())
this._channelAddresses = this._parsedAsyncAPI.channels().all().map(c => c.address())
this._connections = []

const uriTemplateValues = new Map()
Expand Down Expand Up @@ -194,6 +196,10 @@ class GleeAdapter extends EventEmitter {
return this._channelNames
}

get channelAddresses(): string[] {
return this._channelAddresses
}

get connections(): GleeConnection[] {
return this._connections
}
Expand Down

0 comments on commit e1c12f5

Please sign in to comment.