From 45cf1bafa5ca8e1a52ce5f1ceb52eb2bc4841ac4 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Mon, 4 May 2020 11:59:47 +0200 Subject: [PATCH] Configure keycloak at runtime instead of at build time We now pass through all the keycloak config to the vpu-auth element instead of depending on the env.js hardcoded values. The goal is to get rid of env.js in the long run so we only have one bundle build. --- assets/vpu-signature.html.ejs | 8 +++++++- rollup.config.js | 7 +++++++ vendor/app-shell | 2 +- vendor/auth | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/assets/vpu-signature.html.ejs b/assets/vpu-signature.html.ejs index 99f7cc1..4eabd2f 100644 --- a/assets/vpu-signature.html.ejs +++ b/assets/vpu-signature.html.ejs @@ -129,7 +129,13 @@ </head> <body> -<vpu-app-signature lang="de" src="<%= geturl('vpu-signature.topic.metadata.json') %>" entry-point-url="<%= entryPointURL %>" base-path="<%= geturl('') %>"><vpu-loading-spinner></vpu-loading-spinner></vpu-app-signature> +<vpu-app-signature + lang="de" + src="<%= geturl('vpu-signature.topic.metadata.json') %>" + entry-point-url="<%= entryPointURL %>" + base-path="<%= geturl('') %>" + keycloak-config='{"url": "<%= keyCloakBaseURL %>", "realm": "tugraz", "clientId": "<%= keyCloakClientId %>", "silentCheckSsoRedirectUri": "<%= geturl('silent-check-sso.html') %>"}' +><vpu-loading-spinner></vpu-loading-spinner></vpu-app-signature> <!-- Error handling for too old browsers --> <script src="<%= geturl('local/vpu-signature/browser-check.js') %>" defer></script> diff --git a/rollup.config.js b/rollup.config.js index 8b85c51..63eeed7 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -33,6 +33,7 @@ let basePath = ''; let entryPointURL = ''; let keyCloakServer = ''; let keyCloakBaseURL = ''; +let keyCloakClientId = ''; let pdfAsQualifiedlySigningServer = 'sig-dev.tugraz.at'; let matomoSiteId = 131; let useTerser = true; @@ -45,6 +46,7 @@ switch (build) { entryPointURL = 'http://127.0.0.1:8000'; keyCloakServer = 'auth-dev.tugraz.at'; keyCloakBaseURL = 'https://' + keyCloakServer + '/auth'; + keyCloakClientId = 'auth-dev-mw-frontend-local'; useTerser = false; break; case 'development': @@ -52,18 +54,21 @@ switch (build) { entryPointURL = 'https://mw-dev.tugraz.at'; keyCloakServer = 'auth-dev.tugraz.at'; keyCloakBaseURL = 'https://' + keyCloakServer + '/auth'; + keyCloakClientId = 'auth-dev-mw-frontend'; break; case 'demo': basePath = '/apps/signature/'; entryPointURL = 'https://api-demo.tugraz.at'; keyCloakServer = 'auth-test.tugraz.at'; keyCloakBaseURL = 'https://' + keyCloakServer + '/auth'; + keyCloakClientId = 'ibib-demo_tugraz_at-IBIB'; break; case 'production': basePath = '/'; entryPointURL = 'https://api.tugraz.at'; keyCloakServer = 'auth.tugraz.at'; keyCloakBaseURL = 'https://' + keyCloakServer + '/auth'; + keyCloakClientId = 'ibib_tugraz_at-IBIB'; pdfAsQualifiedlySigningServer = 'sig.tugraz.at'; matomoSiteId = 130; break; @@ -72,6 +77,7 @@ switch (build) { entryPointURL = ''; keyCloakServer = ''; keyCloakBaseURL = ''; + keyCloakClientId = ''; useTerser = false; break; default: @@ -200,6 +206,7 @@ export default { entryPointURL: entryPointURL, keyCloakServer: keyCloakServer, keyCloakBaseURL: keyCloakBaseURL, + keyCloakClientId: keyCloakClientId, pdfAsQualifiedlySigningServer: pdfAsQualifiedlySigningServer, environment: build, matomoSiteId: matomoSiteId, diff --git a/vendor/app-shell b/vendor/app-shell index ce1f65f..a22f3f0 160000 --- a/vendor/app-shell +++ b/vendor/app-shell @@ -1 +1 @@ -Subproject commit ce1f65f15e5cf1c22836118e097e7c0558e41ebf +Subproject commit a22f3f056add8c6db83ff3b73fb10df2d24e0e99 diff --git a/vendor/auth b/vendor/auth index b9fbe48..2e17933 160000 --- a/vendor/auth +++ b/vendor/auth @@ -1 +1 @@ -Subproject commit b9fbe487a8a6117ae90a423a8ba318a0321bf51b +Subproject commit 2e179331c2f7572a85e98c825736a3c93494e1ea -- GitLab