diff --git a/core/lib/oauth/client.js b/core/lib/oauth/client.js index 52c51eb6ff422dc0899ccec31baf3fa39e42eeae..d33754cb23f5fb949b367b4ed159e53cb12723fa 100644 --- a/core/lib/oauth/client.js +++ b/core/lib/oauth/client.js @@ -5,9 +5,17 @@ Object.defineProperty(exports, "__esModule", { }); exports.openidClient = openidClient; var _openidClient = require("openid-client"); +var httpProxyAgent = require("https-proxy-agent"); async function openidClient(options) { const provider = options.provider; - if (provider.httpOptions) _openidClient.custom.setHttpOptionsDefaults(provider.httpOptions); + let httpOptions = {}; + if (provider.httpOptions) httpOptions = { ...provider.httpOptions }; + const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy; + if(proxyUrl) { + const agent = new httpProxyAgent.HttpsProxyAgent(proxyUrl); + httpOptions.agent = agent; + } + _openidClient.custom.setHttpOptionsDefaults(httpOptions); let issuer; if (provider.wellKnown) { issuer = await _openidClient.Issuer.discover(provider.wellKnown);