first commit
This commit is contained in:
parent
7071452e66
commit
4a542eaf16
14
config.json
14
config.json
@ -1,13 +1,13 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": "app1",
|
"id": "radarr",
|
||||||
"pathPrefix": "/app1",
|
"pathPrefix": "/radarr",
|
||||||
"upstream": "http://localhost:8081",
|
"upstream": "http://10.1.4.2:7878",
|
||||||
"oidc": {
|
"oidc": {
|
||||||
"issuer": "https://keycloak.example/auth/realms/myrealm",
|
"issuer": "https://sso.leskientz.ovh/realms/master",
|
||||||
"client_id": "app1-client",
|
"client_id": "proxyopenid",
|
||||||
"client_secret": "REPLACE_WITH_SECRET",
|
"client_secret": "biM7eaxeCrzI2OnAoVHOAWe1n2ptAdhz",
|
||||||
"redirect_uri": "http://localhost:3000/callback/app1"
|
"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 { createProxyMiddleware } = require('http-proxy-middleware');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
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 app = express();
|
||||||
const PORT = process.env.PORT || 3000;
|
const PORT = process.env.PORT || 3000;
|
||||||
@ -139,6 +150,10 @@ if (fs.existsSync(cfgPath)) {
|
|||||||
const oidcClients = {};
|
const oidcClients = {};
|
||||||
|
|
||||||
async function setupOidc() {
|
async function setupOidc() {
|
||||||
|
if (!Issuer) {
|
||||||
|
console.warn('openid-client Issuer is unavailable; skipping OIDC setup.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (const host of HOSTS) {
|
for (const host of HOSTS) {
|
||||||
if (host.oidc && host.oidc.issuer) {
|
if (host.oidc && host.oidc.issuer) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user