Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions charts/qtodo/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ Generate the URL of the OIDC service
{{- end }}
{{- end }}

{{/*
Generate the OIDC Client ID based on provider and authentication method
*/}}
{{- define "qtodo.oidc.clientId" }}
{{- if .Values.app.oidc.clientId }}
{{- print .Values.app.oidc.clientId }}
{{- else if eq .Values.app.oidc.provider "entraid" }}
{{- fail "app.oidc.clientId is required when using Entra ID provider" }}
{{- else if .Values.app.oidc.clientAssertion.enabled }}
{{- printf "spiffe://apps.%s/ns/%s/sa/qtodo" .Values.global.clusterDomain .Release.Namespace }}
{{- else }}
{{- print "qtodo-app" }}
{{- end }}
{{- end }}

{{/*
Generate the JWT Audience for SPIFFE authentication
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/qtodo/templates/app-config-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data:
{{- if eq .Values.app.oidc.enabled true }}
QUARKUS_OIDC_ENABLED: "true"
QUARKUS_OIDC_AUTH_SERVER_URL: "{{ include "qtodo.oidc.url" . }}"
QUARKUS_OIDC_CLIENT_ID: "{{ .Values.app.oidc.clientId }}"
QUARKUS_OIDC_CLIENT_ID: "{{ include "qtodo.oidc.clientId" . }}"
QUARKUS_OIDC_APPLICATION_TYPE: "{{ .Values.app.oidc.applicationType }}"
QUARKUS_HTTP_AUTH_PERMISSION_AUTHENTICATED_PATHS: "{{ .Values.app.oidc.authenticatedPaths }}"
QUARKUS_HTTP_AUTH_PERMISSION_AUTHENTICATED_POLICY: "{{ .Values.app.oidc.authenticatedPolicy }}"
Expand Down
2 changes: 1 addition & 1 deletion charts/qtodo/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ app:
provider: "keycloak"
authServerUrl: ""
realm: "ztvp"
clientId: "qtodo-app"
clientId: ""
applicationType: "web-app"
authenticatedPaths: "/*"
authenticatedPolicy: "authenticated"
Expand Down
12 changes: 12 additions & 0 deletions charts/rh-keycloak/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{/*
Generate the qtodo OIDC Client ID based on provider and authentication method
*/}}
{{- define "rh-keycloak.qtodo.oidc.clientId" }}
{{- if .Values.qtodo.oidc.clientId }}
{{- print .Values.qtodo.oidc.clientId }}
{{- else if .Values.qtodo.oidc.clientAssertion.enabled }}
{{- printf "spiffe://apps.%s/ns/%s/sa/%s" .Values.global.clusterDomain .Values.qtodo.namespace .Values.qtodo.serviceAccount }}
{{- else }}
{{- print "qtodo-app" }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/rh-keycloak/templates/qtodo-client-id-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: qtodo-client-id
namespace: {{ .Release.Namespace }}
annotations:
argocd.argoproj.io/sync-wave: "0"
type: Opaque
stringData:
client-id: "{{ include "rh-keycloak.qtodo.oidc.clientId" . }}"
15 changes: 14 additions & 1 deletion charts/rh-keycloak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ cleanup:
enabled: true
image: registry.redhat.io/openshift4/ose-cli-rhel9:latest

# qtodo OIDC client configuration for the Keycloak realm
qtodo:
namespace: qtodo
serviceAccount: qtodo
oidc:
clientId: ""
clientAssertion:
enabled: true

# Values passed through to the rhbk subchart.
rhbk:
global:
Expand Down Expand Up @@ -67,7 +76,7 @@ rhbk:
enabled: true
registrationAllowed: false
clients:
- clientId: qtodo-app
- clientId: ${QTODO_CLIENT_ID}
enabled: true
name: qtodo
protocol: openid-connect
Expand Down Expand Up @@ -506,6 +515,10 @@ rhbk:
secret:
name: rhtpa-oidc-cli-secret
key: client-secret
QTODO_CLIENT_ID:
secret:
name: qtodo-client-id
key: client-id
ACS_CLIENT_SECRET:
secret:
name: acs-oidc-client-secret
Expand Down
Loading