Moved rejectUnauthorized from channel option to connectionOptions

This commit is contained in:
Vinoth Sermakani Alagendran 2024-09-19 11:55:31 +05:30
parent ca9f8c78e1
commit 9e6887368c
2 changed files with 6 additions and 4 deletions

View File

@ -53,6 +53,7 @@ export interface VerifyOptions {
* has been performed on the peer certificate.
*/
checkServerIdentity?: CheckServerIdentityCallback;
rejectUnauthorized?: boolean;
}
/**
@ -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 {

View File

@ -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:
@ -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(