Skip to content

Commit

Permalink
Moved rejectUnauthorized from channel option to connectionOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
vinothsa4891 committed Sep 19, 2024
1 parent ca9f8c7 commit 9e68873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/grpc-js/src/channel-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface VerifyOptions {
* has been performed on the peer certificate.
*/
checkServerIdentity?: CheckServerIdentityCallback;
rejectUnauthorized?: boolean;
}

/**
Expand Down Expand Up @@ -198,6 +199,11 @@ class SecureChannelCredentialsImpl extends ChannelCredentials {
this.connectionOptions.checkServerIdentity =
verifyOptions.checkServerIdentity;
}

if (verifyOptions?.rejectUnauthorized) {
this.connectionOptions.rejectUnauthorized =
verifyOptions.rejectUnauthorized;
}
}

compose(callCredentials: CallCredentials): ChannelCredentials {
Expand Down
4 changes: 0 additions & 4 deletions packages/grpc-js/src/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,6 @@ export class Http2SubchannelConnector implements SubchannelConnector {
...connectionOptions,
...address,
enableTrace: options['grpc-node.tls_enable_trace'] === 1,
rejectUnauthorized: options['grpc-node.tls_reject_unauthorized'] ?? true,
};

/* http2.connect uses the options here:
Expand Down Expand Up @@ -838,9 +837,6 @@ export class Http2SubchannelConnector implements SubchannelConnector {
if (options['grpc-node.tls_enable_trace']) {
connectionOptions.enableTrace = true;
}
if (options['grpc-node.tls_reject_unauthorized']) {
connectionOptions.rejectUnauthorized = options['grpc-node.tls_reject_unauthorized'];
}
}

return getProxiedConnection(address, options, connectionOptions).then(
Expand Down

0 comments on commit 9e68873

Please sign in to comment.