From ab9c26bf345bbc26b04007523b71b098be84655d Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Mon, 4 May 2020 14:04:51 +0200
Subject: [PATCH] Don't read the default keycloak settings from env.js

We don't want to depend on harcoded values in the build
---
 packages/auth/src/auth.js          | 6 +++---
 packages/auth/src/vpu-auth-demo.js | 2 +-
 packages/auth/test/unit.js         | 5 +++++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/packages/auth/src/auth.js b/packages/auth/src/auth.js
index 36bc4077..27c128a2 100644
--- a/packages/auth/src/auth.js
+++ b/packages/auth/src/auth.js
@@ -196,9 +196,9 @@ export class Auth extends ScopedElementsMixin(VPULitElement) {
         super.connectedCallback();
 
         // Keycloak config
-        let baseURL = commonUtils.setting('keyCloakBaseURL');
-        let realm = commonUtils.setting('keyCloakRealm');
-        let clientId = commonUtils.setting('keyCloakClientId');
+        let baseURL = '';
+        let realm = '';
+        let clientId = '';
         let silentCheckSsoRedirectUri = '';
         if (this.keycloakConfig !== null) {
             baseURL = this.keycloakConfig.url || baseURL;
diff --git a/packages/auth/src/vpu-auth-demo.js b/packages/auth/src/vpu-auth-demo.js
index def9f5cb..05a9c2e5 100644
--- a/packages/auth/src/vpu-auth-demo.js
+++ b/packages/auth/src/vpu-auth-demo.js
@@ -84,7 +84,7 @@ class AuthDemo extends ScopedElementsMixin(LitElement) {
                     <h1 class="title">Auth-Demo</h1>
                 </div>
                 <div class="container">
-                    <vpu-auth lang="${this.lang}" keycloak-config='{"silentCheckSsoRedirectUri": "${silentCheckSsoUri}", "scope": "optional-test-scope"}' load-person try-login></vpu-auth>
+                    <vpu-auth lang="${this.lang}" keycloak-config='{"url": "https://auth-dev.tugraz.at/auth", "realm": "tugraz", "clientId": "auth-dev-mw-frontend-local", "silentCheckSsoRedirectUri": "${silentCheckSsoUri}", "scope": "optional-test-scope"}' load-person try-login></vpu-auth>
                 </div>
             </section>
 
diff --git a/packages/auth/test/unit.js b/packages/auth/test/unit.js
index a2640cca..3a3c63e7 100644
--- a/packages/auth/test/unit.js
+++ b/packages/auth/test/unit.js
@@ -8,6 +8,11 @@ suite('vpu-auth basics', () => {
 
   suiteSetup(async () => {
     node = document.createElement('vpu-auth');
+    node.setAttribute('keycloak-config', JSON.stringify({
+        url: 'url',
+        realm: 'realm',
+        clientId: 'clientId',
+    }));
     document.body.appendChild(node);
     await node.updateComplete;
   });
-- 
GitLab