Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

docker compose and kubernetes change to support self-registered user role assignment in keycloak (#1868)

Eric Bariaux564dd88c8548
diff --git a/kubernetes/keycloak/templates/deployment.yaml b/kubernetes/keycloak/templates/deployment.yaml
index 3537a4867..017913473 100644
--- a/kubernetes/keycloak/templates/deployment.yaml
+++ b/kubernetes/keycloak/templates/deployment.yaml
@@ -80,6 +80,8 @@ spec:
value: "{{ .Values.or.keycloak.accountTheme }}"
- name: KEYCLOAK_WELCOME_THEME
value: "{{ .Values.or.keycloak.welcomeTheme }}"
+ - name: KEYCLOAK_SELF_REGISTERED_USER_ROLES
+ value: "{{ .Values.or.keycloak.selfRegisteredUserRoles }}"
{{- with .Values.or.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
diff --git a/kubernetes/keycloak/values.yaml b/kubernetes/keycloak/values.yaml
index 8ec55a7c8..b270443ba 100644
--- a/kubernetes/keycloak/values.yaml
+++ b/kubernetes/keycloak/values.yaml
@@ -137,6 +137,10 @@ or:
accountTheme: "openremote"
welcomeTheme: "keycloak"
+ # Configuration for roles to be assigned to self-registered users (when the listener is enabled)
+ # Example is "{\"realmRoles\":[\"restricted_user\"],\"clientRoles\":[{\"client\":\"openremote\",\"roles\":[\"read:assets\",\"write:attributes\"]}]}"
+ selfRegisteredUserRoles: "{}"
+
# Configure how Keycloak connects to the database
postgresql:
host: "postgresql"
diff --git a/profile/deploy.yml b/profile/deploy.yml
index d410c19ac..1df8b5412 100644
--- a/profile/deploy.yml
+++ b/profile/deploy.yml
@@ -425,6 +425,10 @@ services:
# exposed then the proxy should be configured to validate the host header to prevent abuse
#KEYCLOAK_ISSUER_BASE_URI: 'https://192.168.1.2/auth'
+ # Configuration for roles to be assigned to self-registered users (when the listener is enabled)
+ # Example is "{\"realmRoles\":[\"restricted_user\"],\"clientRoles\":[{\"client\":\"openremote\",\"roles\":[\"read:assets\",\"write:attributes\"]}]}"
+ KEYCLOAK_SELF_REGISTERED_USER_ROLES: "{ }"
+
# Custom JVM options (increase heap size if required)
JAVA_OPTS: ${KEYCLOAK_JAVA_OPTS:-}