fix(oidc): Add configurable HTTP timeout for OIDC client (#1575)

This commit is contained in:
Br1an
2026-03-11 10:30:16 +01:00
committed by GitHub
parent 2685e5d5fc
commit 7604a31a74
5 changed files with 10 additions and 0 deletions
+1
View File
@@ -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/)
+1
View File
@@ -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/)
+1
View File
@@ -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/)
+6
View File
@@ -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);
+1
View File
@@ -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?