From 6c19409567b16015b4329a29219f5b43ef8d8263 Mon Sep 17 00:00:00 2001 From: Erki Aas Date: Thu, 13 Apr 2023 22:38:35 +0300 Subject: [PATCH] Get variables from env --- app.js | 10 +++++----- deployment.yaml | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 0b78980..d08b5f9 100644 --- a/app.js +++ b/app.js @@ -7,12 +7,12 @@ async function run() { app.use(bodyParser.urlencoded()); app.use(bodyParser.json()) - const issuer = await Issuer.discover('https://gateway-gab7y.codemowers.ee/'); + const issuer = await Issuer.discover(process.env.OIDC_GATEWAY_URI); console.log('Discovered issuer %s %O', issuer.issuer, issuer.metadata); const client = new issuer.Client({ - client_id: 'foo', - redirect_uris: ['https://client-gab7y.codemowers.ee/cb'], + client_id: process.env.OIDC_CLIENT_ID, + redirect_uris: [process.env.OIDC_REDIRECT_URIS], response_types: ['id_token'], // id_token_signed_response_alg (default "RS256") }) @@ -20,7 +20,7 @@ async function run() { app.get('/', async function (req, res) { let url = client.authorizationUrl({ - redirect_uri: 'https://client-gab7y.codemowers.ee/cb', + redirect_uri: process.env.CLIENT_URL + '/cb', scope: 'openid', response_mode: 'form_post', nonce, @@ -30,7 +30,7 @@ async function run() { }); app.post('/cb', async function (req, res) { const params = client.callbackParams(req); - const tokenSet = await client.callback('https://client-gab7y.codemowers.ee/ok', params, {nonce}); + const tokenSet = await client.callback(process.env.CLIENT_URL + '/cb', params, {nonce}); console.log('received and validated tokens %j', tokenSet); console.log('validated ID Token claims %j', tokenSet.claims()); res.send(tokenSet.claims()); diff --git a/deployment.yaml b/deployment.yaml index b56a10e..578a260 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -58,3 +58,9 @@ spec: image: oidc-test-client ports: - containerPort: 3000 + env: + - name: CLIENT_URL + value: https://client-gab7y.codemowers.ee + envFrom: + - secretRef: + name: oidc-client-implicit-id-token-sample-client-owner-secrets