diff --git a/CHANGELOG.md b/CHANGELOG.md index 92921d36f..19acd732d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added - Webhook proxy security enhancements ([#1398](https://github.com/opendevstack/ods-core/pull/1398/)) +- Add client credentials support to external services templates in the ODS API Service ([#1388](https://github.com/opendevstack/ods-core/pull/1388)) ### Changed diff --git a/ods-api-service/chart/templates/tpl/_application_yaml.tpl b/ods-api-service/chart/templates/tpl/_application_yaml.tpl index 7f0593274..089c289bf 100644 --- a/ods-api-service/chart/templates/tpl/_application_yaml.tpl +++ b/ods-api-service/chart/templates/tpl/_application_yaml.tpl @@ -190,6 +190,8 @@ externalservices: bypass: audience: ${MARKETPLACE_{{ $name | upper | replace "-" "_" }}_BYPASS_AUDIENCE:} scope: ${MARKETPLACE_{{ $name | upper | replace "-" "_" }}_BYPASS_SCOPE:} + tenant-id: ${AZURE_{{ $name | upper | replace "-" "_" }}_TENANT_ID:} + client-credentials-scope: ${MARKETPLACE_{{ $name | upper | replace "-" "_" }}_CLIENT_CREDENTIALS_SCOPE:} {{- end }} {{- else }} instances: {} diff --git a/ods-api-service/chart/templates/tpl/_env_application.tpl b/ods-api-service/chart/templates/tpl/_env_application.tpl index 14e40b716..9a43a8869 100644 --- a/ods-api-service/chart/templates/tpl/_env_application.tpl +++ b/ods-api-service/chart/templates/tpl/_env_application.tpl @@ -11,4 +11,7 @@ AZURE_TENANT_ID: {{ .Values.spring.security.obo.azureTenant | b64enc | quote }} OBO_TOKEN_URL: {{ .Values.spring.security.obo.tokenUrl | b64enc | quote }} OBO_CLIENT_ID: {{ .Values.spring.security.obo.clientId | b64enc | quote }} OBO_CLIENT_SECRET: {{ .Values.spring.security.obo.clientSecret | b64enc | quote }} +CLIENT_CREDENTIALS_TOKEN_URL: {{ .Values.spring.security.clientCredentials.tokenUrl | b64enc | quote }} +CLIENT_CREDENTIALS_CLIENT_ID: {{ .Values.spring.security.clientCredentials.clientId | b64enc | quote }} +CLIENT_CREDENTIALS_CLIENT_SECRET: {{ .Values.spring.security.clientCredentials.clientSecret | b64enc | quote }} {{- end }} diff --git a/ods-api-service/chart/templates/tpl/_env_external_services.tpl b/ods-api-service/chart/templates/tpl/_env_external_services.tpl index a8bc3316e..2bc298b5a 100644 --- a/ods-api-service/chart/templates/tpl/_env_external_services.tpl +++ b/ods-api-service/chart/templates/tpl/_env_external_services.tpl @@ -89,6 +89,7 @@ MARKETPLACE_{{ $name | upper | replace "-" "_" }}_TRUST_ALL: {{ $instance.trustA MARKETPLACE_{{ $name | upper | replace "-" "_" }}_OBO_SCOPE: {{ $instance.oboScope | quote }} MARKETPLACE_{{ $name | upper | replace "-" "_" }}_BYPASS_AUDIENCE: {{ $instance.bypass.audience | default "" | quote }} MARKETPLACE_{{ $name | upper | replace "-" "_" }}_BYPASS_SCOPE: {{ $instance.bypass.scope | default "" | quote }} +MARKETPLACE_{{ $name | upper | replace "-" "_" }}_CLIENT_CREDENTIALS_SCOPE: {{ $instance.clientCredentials | quote }} {{- end }} {{- end }} @@ -161,6 +162,9 @@ MARKETPLACE_{{ $name | upper | replace "-" "_" }}_USERNAME: {{ $instance.usernam {{- if $instance.password }} MARKETPLACE_{{ $name | upper | replace "-" "_" }}_PASSWORD: {{ $instance.password | b64enc | quote }} {{- end }} +{{- if $instance.clientCredentialsScope }} +MARKETPLACE_{{ $name | upper | replace "-" "_" }}_CLIENT_CREDENTIALS_SCOPE: {{ $instance.clientCredentialsScope | b64enc | quote }} +{{- end }} {{- end }} {{- end }}