Require https callback in production, allow for http otherwise

This commit is contained in:
Rory Powell 2021-07-23 15:47:48 +01:00
parent 32cf132022
commit eb8d857864
1 changed files with 3 additions and 1 deletions

View File

@ -144,7 +144,9 @@ async function oidcStrategyFactory(ctx, configId) {
const chosenConfig = config.configs.filter(c => c.uuid === configId)[0] const chosenConfig = config.configs.filter(c => c.uuid === configId)[0]
const callbackUrl = `${ctx.protocol}://${ctx.host}/api/admin/auth/oidc/callback` // require https callback in production
const protocol = process.env.NODE_ENV === "production" ? "https" : "http"
const callbackUrl = `${protocol}://${ctx.host}/api/admin/auth/oidc/callback`
return oidc.strategyFactory(chosenConfig, callbackUrl) return oidc.strategyFactory(chosenConfig, callbackUrl)
} }