diff --git a/app/app.js b/app/app.js index f960debc5..e2e202789 100644 --- a/app/app.js +++ b/app/app.js @@ -5,7 +5,6 @@ const path = require('path'); const Problem = require('api-problem'); const querystring = require('querystring'); -const keycloak = require('./src/components/keycloak'); const log = require('./src/components/log')(module.filename); const httpLogger = require('./src/components/log').httpLogger; const middleware = require('./src/forms/common/middleware'); @@ -40,9 +39,6 @@ if (process.env.NODE_ENV !== 'test') { app.use(httpLogger); } -// Use Keycloak OIDC Middleware -app.use(keycloak.middleware()); - // Block requests until service is ready app.use((_req, res, next) => { if (state.shutdown) { @@ -178,11 +174,16 @@ function initializeConnections() { .then((results) => { state.connections.data = results[0]; - if (state.connections.data) log.info('DataConnection Reachable', { function: 'initializeConnections' }); + if (state.connections.data) + log.info('DataConnection Reachable', { + function: 'initializeConnections', + }); }) .catch((error) => { log.error(`Initialization failed: Database OK = ${state.connections.data}`, { function: 'initializeConnections' }); - log.error('Connection initialization failure', error.message, { function: 'initializeConnections' }); + log.error('Connection initialization failure', error.message, { + function: 'initializeConnections', + }); if (!state.ready) { process.exitCode = 1; shutdown(); @@ -191,7 +192,9 @@ function initializeConnections() { .finally(() => { state.ready = Object.values(state.connections).every((x) => x); if (state.ready) { - log.info('Service ready to accept traffic', { function: 'initializeConnections' }); + log.info('Service ready to accept traffic', { + function: 'initializeConnections', + }); // Start periodic 10 second connection probe check probeId = setInterval(checkConnections, 10000); } @@ -211,7 +214,10 @@ function checkConnections() { Promise.all(tasks).then((results) => { state.connections.data = results[0]; state.ready = Object.values(state.connections).every((x) => x); - if (!wasReady && state.ready) log.info('Service ready to accept traffic', { function: 'checkConnections' }); + if (!wasReady && state.ready) + log.info('Service ready to accept traffic', { + function: 'checkConnections', + }); log.verbose(state); if (!state.ready) { process.exitCode = 1; diff --git a/app/config/custom-environment-variables.json b/app/config/custom-environment-variables.json index ca034709e..06d1c82b6 100755 --- a/app/config/custom-environment-variables.json +++ b/app/config/custom-environment-variables.json @@ -35,7 +35,8 @@ "keycloak": { "clientId": "FRONTEND_KC_CLIENTID", "realm": "FRONTEND_KC_REALM", - "serverUrl": "FRONTEND_KC_SERVERURL" + "serverUrl": "FRONTEND_KC_SERVERURL", + "logoutUrl": "FRONTEND_KC_LOGOUTURL" } }, "server": { @@ -43,11 +44,11 @@ "basePath": "SERVER_BASEPATH", "bodyLimit": "SERVER_BODYLIMIT", "keycloak": { - "clientId": "SERVER_KC_CLIENTID", - "clientSecret": "SERVER_KC_CLIENTSECRET", - "publicKey": "SERVER_KC_PUBLICKEY", - "realm": "SERVER_KC_REALM", - "serverUrl": "SERVER_KC_SERVERURL" + "serverUrl": "SERVER_KC_SERVERURL", + "jwksUri": "SERVER_KC_JWKSURI", + "issuer": "SERVER_KC_ISSUER", + "audience": "SERVER_KC_AUDIENCE", + "maxTokenAge": "SERVER_KC_MAXTOKENAGE" }, "logFile": "SERVER_LOGFILE", "logLevel": "SERVER_LOGLEVEL", diff --git a/app/config/default.json b/app/config/default.json index 3fadfbf56..99bb82950 100644 --- a/app/config/default.json +++ b/app/config/default.json @@ -32,8 +32,9 @@ "basePath": "/app", "keycloak": { "clientId": "chefs-frontend", - "realm": "chefs", - "serverUrl": "https://dev.loginproxy.gov.bc.ca/auth" + "realm": "standard", + "serverUrl": "https://dev.loginproxy.gov.bc.ca/auth", + "logoutUrl": "https://logon7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=https%3A%2F%2Fdev.loginproxy.gov.bc.ca%2Fauth%2Frealms%2Fstandard%2Fprotocol%2Fopenid-connect%2Flogout%3Fpost_logout_redirect_uri%3Dhttp%3A%2F%2Flocalhost%3A5173%2Fapp%26client_id%3Dchefs-frontend" } }, "server": { @@ -41,9 +42,12 @@ "basePath": "/app", "bodyLimit": "30mb", "keycloak": { - "clientId": "chefs", - "realm": "chefs", - "serverUrl": "https://dev.loginproxy.gov.bc.ca/auth" + "realm": "standard", + "serverUrl": "https://dev.loginproxy.gov.bc.ca/auth", + "jwksUri": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard/protocol/openid-connect/certs", + "issuer": "https://dev.loginproxy.gov.bc.ca/auth/realms/standard", + "audience": "chefs-frontend", + "maxTokenAge": "300" }, "logLevel": "http", "port": "8080", diff --git a/app/frontend/src/components/base/BaseSecure.vue b/app/frontend/src/components/base/BaseSecure.vue index f4ee5e424..d75aa7761 100755 --- a/app/frontend/src/components/base/BaseSecure.vue +++ b/app/frontend/src/components/base/BaseSecure.vue @@ -20,7 +20,6 @@ export default { 'authenticated', 'identityProvider', 'isAdmin', - 'isUser', 'ready', ]), ...mapState(useFormStore, ['lang']), @@ -44,48 +43,32 @@ export default {