From 14cc7fc55d2201cb9d903e5219b4d2d8a584be4e Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Fri, 1 Mar 2024 11:04:48 +0100
Subject: [PATCH] OZG-4939: OZG-5045: Use a default Origin and if configured in
 the values, also additional ones.

---
 ...keycloak-client-crd.yaml => keycloak_client_crd.yaml} | 9 ++++-----
 src/test/helm/keycloak_client_crd_test.yaml              | 5 +++--
 2 files changed, 7 insertions(+), 7 deletions(-)
 rename src/main/helm/templates/{keycloak-client-crd.yaml => keycloak_client_crd.yaml} (92%)

diff --git a/src/main/helm/templates/keycloak-client-crd.yaml b/src/main/helm/templates/keycloak_client_crd.yaml
similarity index 92%
rename from src/main/helm/templates/keycloak-client-crd.yaml
rename to src/main/helm/templates/keycloak_client_crd.yaml
index 309d37ae..c1f22186 100644
--- a/src/main/helm/templates/keycloak-client-crd.yaml
+++ b/src/main/helm/templates/keycloak_client_crd.yaml
@@ -10,15 +10,14 @@ spec:
   keep_after_delete: {{ $.Values.sso.keep_after_delete | default false }}
   client_name: {{ $client.client_name }}
   client_base_url: https://{{ include "app.baseDomain" $ }}  
-{{- if $client.client_web_origins }}
+
   client_web_origins:
+    - https://{{ include "app.baseDomain" $ }}
+  {{- if $client.client_web_origins }}
     {{- with $client.client_web_origins }}
 {{ toYaml . | indent 4 }}
     {{- end }}
-{{- else }}
-  client_web_origins:
-    - https://{{ include "app.baseDomain" $ }}
-{{- end }}
+  {{- end }}
   client_redirect_uris:
     - https://{{ include "app.baseDomain" $ }}
     - https://{{ include "app.baseDomain" $ }}/*
diff --git a/src/test/helm/keycloak_client_crd_test.yaml b/src/test/helm/keycloak_client_crd_test.yaml
index 81951ff2..af45d2d6 100644
--- a/src/test/helm/keycloak_client_crd_test.yaml
+++ b/src/test/helm/keycloak_client_crd_test.yaml
@@ -27,7 +27,7 @@ release:
   name: administration
   namespace: by-helm-test
 templates:
-  - templates/keycloak-client-crd.yaml
+  - templates/keycloak_client_crd.yaml
 set:
   ozgcloud:
     bundesland: by
@@ -114,7 +114,7 @@ tests:
           value:
             - https://helm-admin.ozg-sh.de
             - https://helm-admin.ozg-sh.de/*
-  - it: should override client web origins
+  - it: should use additional client web origins
     set:
       sso:
         keycloak_clients:
@@ -126,6 +126,7 @@ tests:
       - equal:
           path: spec.client_web_origins
           value:
+            - https://helm-admin.ozg-sh.de
             - https://some.origin.de
             - https://some.other.origin.de
   - it: should use additional redirect uris for client web origins
-- 
GitLab