Make rejectUnauthorized true if ca cert is passed for k8s auth method

This commit is contained in:
Tuan Dang
2024-05-14 22:49:37 -07:00
parent e4afbe8662
commit ace008f44e

View File

@@ -115,11 +115,9 @@ export const identityKubernetesAuthServiceFactory = ({
"Content-Type": "application/json",
Authorization: `Bearer ${tokenReviewerJwt}`
},
...(caCert && {
httpsAgent: new https.Agent({
ca: caCert,
rejectUnauthorized: true
})
httpsAgent: new https.Agent({
ca: caCert,
rejectUnauthorized: !!caCert
})
}
);