Skip to content

Commit 5358f8e

Browse files
committed
#1946 fix devops oauth subjects not being configured correctly with environment variable
Signed-off-by: Thomas Jäckle <[email protected]>
1 parent 8636401 commit 5358f8e

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

deployment/helm/ditto/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description: |
1616
A digital twin is a virtual, cloud based, representation of his real world counterpart
1717
(real world “Things”, e.g. devices like sensors, smart heating, connected cars, smart grids, EV charging stations etc).
1818
type: application
19-
version: 3.5.6 # chart version is effectively set by release-job
19+
version: 3.5.7-0 # chart version is effectively set by release-job
2020
appVersion: 3.5.6
2121
keywords:
2222
- iot-chart

deployment/helm/ditto/templates/gateway-deployment.yaml

+6-8
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ spec:
149149
"{{ printf "%s%s%s%d=%s" "-Dditto.gateway.authentication.devops.oauth.openid-connect-issuers." $key ".auth-subjects." $index $subject }}"
150150
{{- end }}
151151
{{- end }}
152+
{{- range $index, $oauthSubject := .Values.gateway.config.authentication.devops.oauthSubjects }}
153+
"{{ printf "%s%d=%s" "-Dditto.gateway.authentication.devops.devops-oauth2-subjects." $index $oauthSubject }}"
154+
{{- end }}
155+
{{- range $index, $oauthSubject := .Values.gateway.config.authentication.devops.statusOauthSubjects }}
156+
"{{ printf "%s%d=%s" "-Dditto.gateway.authentication.devops.status-oauth2-subjects." $index $oauthSubject }}"
157+
{{- end }}
152158
{{ join " " .Values.gateway.systemProps }}
153159
- name: CLUSTER_BS_REQUIRED_CONTACTS
154160
value: "{{ .Values.global.cluster.requiredContactPoints }}"
@@ -191,10 +197,6 @@ spec:
191197
secretKeyRef:
192198
name: {{ .Values.gateway.config.authentication.devops.existingSecret | default ( printf "%s-gateway-secret" ( include "ditto.fullname" . )) }}
193199
key: devops-password
194-
{{- range $index, $oauthSubject := .Values.gateway.config.authentication.devops.oauthSubjects }}
195-
- name: DEVOPS_OAUTH2_SUBJECTS.{{ $index }}
196-
value: "{{ $oauthSubject }}"
197-
{{- end }}
198200
- name: DEVOPS_STATUS_SECURED
199201
value: "{{ .Values.gateway.config.authentication.devops.statusSecured }}"
200202
- name: STATUS_AUTHENTICATION_METHOD
@@ -204,10 +206,6 @@ spec:
204206
secretKeyRef:
205207
name: {{ .Values.gateway.config.authentication.devops.existingSecret | default ( printf "%s-gateway-secret" ( include "ditto.fullname" . )) }}
206208
key: status-password
207-
{{- range $index, $oauthSubject := .Values.gateway.config.authentication.devops.statusOauthSubjects }}
208-
- name: STATUS_OAUTH2_SUBJECTS.{{ $index }}
209-
value: "{{ $oauthSubject }}"
210-
{{- end }}
211209
- name: WS_SUBSCRIBER_BACKPRESSURE
212210
value: "{{ .Values.gateway.config.websocket.subscriber.backpressureQueueSize }}"
213211
- name: WS_PUBLISHER_BACKPRESSURE

gateway/service/src/test/java/org/eclipse/ditto/gateway/service/endpoints/routes/devops/DevOpsRouteTest.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515

1616
import java.util.Collections;
1717

18+
import org.apache.pekko.http.javadsl.model.ContentTypes;
19+
import org.apache.pekko.http.javadsl.model.HttpEntities;
20+
import org.apache.pekko.http.javadsl.model.HttpRequest;
21+
import org.apache.pekko.http.javadsl.model.RequestEntity;
22+
import org.apache.pekko.http.javadsl.model.StatusCodes;
23+
import org.apache.pekko.http.javadsl.server.Route;
24+
import org.apache.pekko.http.javadsl.testkit.TestRoute;
1825
import org.eclipse.ditto.base.api.devops.signals.commands.ExecutePiggybackCommand;
1926
import org.eclipse.ditto.base.model.headers.DittoHeaders;
2027
import org.eclipse.ditto.gateway.service.endpoints.EndpointTestBase;
@@ -28,14 +35,6 @@
2835

2936
import com.typesafe.config.ConfigFactory;
3037

31-
import org.apache.pekko.http.javadsl.model.ContentTypes;
32-
import org.apache.pekko.http.javadsl.model.HttpEntities;
33-
import org.apache.pekko.http.javadsl.model.HttpRequest;
34-
import org.apache.pekko.http.javadsl.model.RequestEntity;
35-
import org.apache.pekko.http.javadsl.model.StatusCodes;
36-
import org.apache.pekko.http.javadsl.server.Route;
37-
import org.apache.pekko.http.javadsl.testkit.TestRoute;
38-
3938
/**
4039
* Unit test for {@link DevOpsRoute}.
4140
*/
@@ -48,7 +47,7 @@ public final class DevOpsRouteTest extends EndpointTestBase {
4847
@Before
4948
public void setUp() {
5049
final var devopsAuthenticationDirectiveFactory =
51-
DevopsAuthenticationDirectiveFactory.newInstance(jwtAuthenticationFactory, getInsecureDevopsConfig());
50+
DevopsAuthenticationDirectiveFactory.newInstance(jwtAuthenticationFactory, getInsecureDevopsConfig(), ConfigFactory.empty());
5251
final var authenticationDirective = devopsAuthenticationDirectiveFactory.devops();
5352
devOpsRoute = new DevOpsRoute(routeBaseProperties, authenticationDirective);
5453
final Route route = extractRequestContext(ctx -> devOpsRoute.buildDevOpsRoute(ctx, Collections.emptyMap()));

0 commit comments

Comments
 (0)