first commit
This commit is contained in:
parent
7071452e66
commit
4a542eaf16
14
config.json
14
config.json
@ -1,13 +1,13 @@
|
||||
[
|
||||
{
|
||||
"id": "app1",
|
||||
"pathPrefix": "/app1",
|
||||
"upstream": "http://localhost:8081",
|
||||
"id": "radarr",
|
||||
"pathPrefix": "/radarr",
|
||||
"upstream": "http://10.1.4.2:7878",
|
||||
"oidc": {
|
||||
"issuer": "https://keycloak.example/auth/realms/myrealm",
|
||||
"client_id": "app1-client",
|
||||
"client_secret": "REPLACE_WITH_SECRET",
|
||||
"redirect_uri": "http://localhost:3000/callback/app1"
|
||||
"issuer": "https://sso.leskientz.ovh/realms/master",
|
||||
"client_id": "proxyopenid",
|
||||
"client_secret": "biM7eaxeCrzI2OnAoVHOAWe1n2ptAdhz",
|
||||
"redirect_uri": "https://secure.k2r.ovh/callback/app1"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
17
server.js
17
server.js
@ -5,7 +5,18 @@ const bodyParser = require('body-parser');
|
||||
const { createProxyMiddleware } = require('http-proxy-middleware');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { Issuer, generators } = require('openid-client');
|
||||
|
||||
// Import openid-client in a way that works with both CJS and ESM builds.
|
||||
let Issuer, generators;
|
||||
try {
|
||||
const oc = require('openid-client');
|
||||
// package may export under .default for some ESM->CJS interop
|
||||
Issuer = oc.Issuer || (oc.default && oc.default.Issuer);
|
||||
generators = oc.generators || (oc.default && oc.default.generators);
|
||||
} catch (err) {
|
||||
// don't crash here — we'll log and skip OIDC setup later
|
||||
console.warn('openid-client not available via require():', err.message);
|
||||
}
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
@ -139,6 +150,10 @@ if (fs.existsSync(cfgPath)) {
|
||||
const oidcClients = {};
|
||||
|
||||
async function setupOidc() {
|
||||
if (!Issuer) {
|
||||
console.warn('openid-client Issuer is unavailable; skipping OIDC setup.');
|
||||
return;
|
||||
}
|
||||
for (const host of HOSTS) {
|
||||
if (host.oidc && host.oidc.issuer) {
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user