mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-10-29 23:35:02 -04:00
finally add http/s_proxy support for oidc and more in future #6616
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
7681f52ee6
commit
1bd06ccded
@ -58,6 +58,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
|||||||
// Setup WebAuthn / FIDO2
|
// Setup WebAuthn / FIDO2
|
||||||
obj.webauthn = require('./webauthn.js').CreateWebAuthnModule();
|
obj.webauthn = require('./webauthn.js').CreateWebAuthnModule();
|
||||||
|
|
||||||
|
if (process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']) {
|
||||||
|
obj.httpsProxyAgent = new (require('https-proxy-agent').HttpsProxyAgent)(process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']);
|
||||||
|
}
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
obj.args = args;
|
obj.args = args;
|
||||||
obj.parent = parent;
|
obj.parent = parent;
|
||||||
@ -7979,6 +7983,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
|||||||
}
|
}
|
||||||
strategy.options.params.scope = strategy.options.params.scope.join(' ')
|
strategy.options.params.scope = strategy.options.params.scope.join(' ')
|
||||||
|
|
||||||
|
if (obj.httpsProxyAgent) {
|
||||||
|
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // add using environment variables if needs be not here
|
||||||
|
strategy.obj.openidClient.custom.setHttpOptionsDefaults({ agent: obj.httpsProxyAgent });
|
||||||
|
}
|
||||||
// Discover additional information if available, use endpoints from config if present
|
// Discover additional information if available, use endpoints from config if present
|
||||||
let issuer
|
let issuer
|
||||||
try {
|
try {
|
||||||
@ -8182,6 +8190,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
|||||||
const options = {
|
const options = {
|
||||||
'headers': { authorization: 'Bearer ' + tokenset.access_token }
|
'headers': { authorization: 'Bearer ' + tokenset.access_token }
|
||||||
}
|
}
|
||||||
|
if (obj.httpsProxyAgent) { options.agent = obj.httpsProxyAgent; }
|
||||||
const req = require('https').get(url, options, (res) => {
|
const req = require('https').get(url, options, (res) => {
|
||||||
let data = []
|
let data = []
|
||||||
res.on('data', (chunk) => {
|
res.on('data', (chunk) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user