fix(oidc): Add configurable HTTP timeout for OIDC client (#1575)
This commit is contained in:
@@ -78,6 +78,7 @@ services:
|
|||||||
# - OIDC_IGNORE_USERNAME=true
|
# - OIDC_IGNORE_USERNAME=true
|
||||||
# - OIDC_IGNORE_ROLES=true
|
# - OIDC_IGNORE_ROLES=true
|
||||||
# - OIDC_ENFORCED=true
|
# - OIDC_ENFORCED=true
|
||||||
|
# - OIDC_TIMEOUT=3500
|
||||||
# - OIDC_DEBUG=true
|
# - OIDC_DEBUG=true
|
||||||
|
|
||||||
# Email Notifications (https://nodemailer.com/smtp/)
|
# Email Notifications (https://nodemailer.com/smtp/)
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ services:
|
|||||||
# - OIDC_IGNORE_USERNAME=true
|
# - OIDC_IGNORE_USERNAME=true
|
||||||
# - OIDC_IGNORE_ROLES=true
|
# - OIDC_IGNORE_ROLES=true
|
||||||
# - OIDC_ENFORCED=true
|
# - OIDC_ENFORCED=true
|
||||||
|
# - OIDC_TIMEOUT=3500
|
||||||
# - OIDC_DEBUG=true
|
# - OIDC_DEBUG=true
|
||||||
|
|
||||||
# Email Notifications (https://nodemailer.com/smtp/)
|
# Email Notifications (https://nodemailer.com/smtp/)
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ SECRET_KEY=notsecretkey
|
|||||||
# OIDC_IGNORE_USERNAME=true
|
# OIDC_IGNORE_USERNAME=true
|
||||||
# OIDC_IGNORE_ROLES=true
|
# OIDC_IGNORE_ROLES=true
|
||||||
# OIDC_ENFORCED=true
|
# OIDC_ENFORCED=true
|
||||||
|
# OIDC_TIMEOUT=3500
|
||||||
# OIDC_DEBUG=true
|
# OIDC_DEBUG=true
|
||||||
|
|
||||||
# Email Notifications (https://nodemailer.com/smtp/)
|
# Email Notifications (https://nodemailer.com/smtp/)
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ module.exports = function defineOidcHook(sails) {
|
|||||||
clientInitPromise = (async () => {
|
clientInitPromise = (async () => {
|
||||||
sails.log.info('Initializing OIDC client');
|
sails.log.info('Initializing OIDC client');
|
||||||
|
|
||||||
|
if (sails.config.custom.oidcTimeout !== null) {
|
||||||
|
openidClient.custom.setHttpOptionsDefaults({
|
||||||
|
timeout: sails.config.custom.oidcTimeout,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let issuer;
|
let issuer;
|
||||||
try {
|
try {
|
||||||
issuer = await openidClient.Issuer.discover(sails.config.custom.oidcIssuer);
|
issuer = await openidClient.Issuer.discover(sails.config.custom.oidcIssuer);
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ module.exports.custom = {
|
|||||||
oidcIgnoreUsername: process.env.OIDC_IGNORE_USERNAME === 'true',
|
oidcIgnoreUsername: process.env.OIDC_IGNORE_USERNAME === 'true',
|
||||||
oidcIgnoreRoles: process.env.OIDC_IGNORE_ROLES === 'true',
|
oidcIgnoreRoles: process.env.OIDC_IGNORE_ROLES === 'true',
|
||||||
oidcEnforced: process.env.OIDC_ENFORCED === 'true',
|
oidcEnforced: process.env.OIDC_ENFORCED === 'true',
|
||||||
|
oidcTimeout: envToNumber(process.env.OIDC_TIMEOUT),
|
||||||
oidcDebug: process.env.OIDC_DEBUG === 'true',
|
oidcDebug: process.env.OIDC_DEBUG === 'true',
|
||||||
|
|
||||||
// TODO: move client base url to environment variable?
|
// TODO: move client base url to environment variable?
|
||||||
|
|||||||
Reference in New Issue
Block a user