Skip to content

Commit 9e68873

Browse files
committed
Moved rejectUnauthorized from channel option to connectionOptions
1 parent ca9f8c7 commit 9e68873

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/grpc-js/src/channel-credentials.ts

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface VerifyOptions {
5353
* has been performed on the peer certificate.
5454
*/
5555
checkServerIdentity?: CheckServerIdentityCallback;
56+
rejectUnauthorized?: boolean;
5657
}
5758

5859
/**
@@ -198,6 +199,11 @@ class SecureChannelCredentialsImpl extends ChannelCredentials {
198199
this.connectionOptions.checkServerIdentity =
199200
verifyOptions.checkServerIdentity;
200201
}
202+
203+
if (verifyOptions?.rejectUnauthorized) {
204+
this.connectionOptions.rejectUnauthorized =
205+
verifyOptions.rejectUnauthorized;
206+
}
201207
}
202208

203209
compose(callCredentials: CallCredentials): ChannelCredentials {

packages/grpc-js/src/transport.ts

-4
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,6 @@ export class Http2SubchannelConnector implements SubchannelConnector {
743743
...connectionOptions,
744744
...address,
745745
enableTrace: options['grpc-node.tls_enable_trace'] === 1,
746-
rejectUnauthorized: options['grpc-node.tls_reject_unauthorized'] ?? true,
747746
};
748747

749748
/* http2.connect uses the options here:
@@ -838,9 +837,6 @@ export class Http2SubchannelConnector implements SubchannelConnector {
838837
if (options['grpc-node.tls_enable_trace']) {
839838
connectionOptions.enableTrace = true;
840839
}
841-
if (options['grpc-node.tls_reject_unauthorized']) {
842-
connectionOptions.rejectUnauthorized = options['grpc-node.tls_reject_unauthorized'];
843-
}
844840
}
845841

846842
return getProxiedConnection(address, options, connectionOptions).then(

0 commit comments

Comments
 (0)