Skip to content

Commit 97bfa5f

Browse files
feat: add delegated auth + tests
1 parent e255142 commit 97bfa5f

File tree

7 files changed

+49
-5
lines changed

7 files changed

+49
-5
lines changed

.github/workflows/deployment-test.yaml

+35-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
- name: Checkout
8787
uses: actions/checkout@v4
8888
- uses: ./.github/actions/run-deployment-test
89-
name: "Run deployment test using KinD and Helm"
89+
name: "Run deployment test using KinD and Helm - tokenbased auth"
9090
with:
9191
imagename: "edc-controlplane-postgresql-hashicorp-vault edc-dataplane-hashicorp-vault"
9292
rootDir: "edc-controlplane/edc-controlplane-postgresql-hashicorp-vault edc-dataplane/edc-dataplane-hashicorp-vault"
@@ -101,8 +101,40 @@ jobs:
101101
kubectl rollout status deployment tx-prod-controlplane
102102
kubectl rollout status deployment tx-prod-dataplane
103103
104-
# execute the helm test
105-
helm test tx-prod
104+
# execute the helm test using token based auth in the Management API
105+
helm test tx-prod --filter name=controlplane-with-token-auth-test
106+
107+
- uses: ./.github/actions/run-deployment-test
108+
name: "Run deployment test using KinD and Helm - delegated auth"
109+
with:
110+
imagename: "edc-controlplane-postgresql-hashicorp-vault edc-dataplane-hashicorp-vault"
111+
rootDir: "edc-controlplane/edc-controlplane-postgresql-hashicorp-vault edc-dataplane/edc-dataplane-hashicorp-vault"
112+
k8sversion: ${{ matrix.k8s-version }}
113+
helm_command: |-
114+
helm install tx-prod charts/tractusx-connector \
115+
-f edc-tests/deployment/src/main/resources/helm/tractusx-connector-test.yaml \
116+
--set controlplane.endpoints.management.jwksUrl="http://foo-bar.com/.well-known/jwks.json" \
117+
--dependency-update \
118+
--wait-for-jobs --timeout=120s
119+
120+
# wait for the pod to become ready
121+
kubectl rollout status deployment tx-prod-controlplane
122+
kubectl rollout status deployment tx-prod-dataplane
123+
124+
kubectl port-forward service/tx-prod-controlplane 8081:8081 &
125+
126+
code=$(curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer sdfasdfasdf" -d '{
127+
"@context": {
128+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/"
129+
},
130+
"@id": "tx:BPN000001234",
131+
"tx:groups": ["group1", "group2", "group3"]
132+
}' --silent -o /dev/null -w '%{http_code}' http://localhost:8081/management/v3/business-partner-groups)
133+
134+
if [[ $code -ne 401 ]]; then
135+
echo "Expected a HTTP 401, got $code"
136+
exit 1;
137+
fi
106138
107139
test-azure-vault-postgres:
108140
runs-on: ubuntu-latest

charts/tractusx-connector/templates/deployment-controlplane.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,14 @@ spec:
152152
#######
153153
# API #
154154
#######
155+
{{- if .Values.controlplane.endpoints.management.jwksUrl }}
156+
- name: "EDC_API_AUTH_DAC_KEY_URL"
157+
value: {{ .Values.controlplane.endpoints.management.jwksUrl | quote}}
158+
{{- else }}
155159
- name: "EDC_API_AUTH_KEY"
156160
value: {{ .Values.controlplane.endpoints.management.authKey | required ".Values.controlplane.endpoints.management.authKey is required" | quote }}
161+
{{- end }}
162+
157163
- name: "WEB_HTTP_DEFAULT_PORT"
158164
value: {{ .Values.controlplane.endpoints.default.port | quote }}
159165
- name: "WEB_HTTP_DEFAULT_PATH"

charts/tractusx-connector/templates/tests/test-controlplane.yaml renamed to charts/tractusx-connector/templates/tests/controlplane-with-token-auth.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
apiVersion: v1
2222
kind: Pod
2323
metadata:
24-
name: "{{include "txdc.fullname" .}}-test-controlplane"
24+
name: "controlplane-with-token-auth-test"
2525
labels:
2626
{{- include "txdc.controlplane.labels" . | nindent 4 }}
2727
annotations:

charts/tractusx-connector/values.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ controlplane:
124124
path: /management
125125
# -- authentication key, must be attached to each request as `X-Api-Key` header
126126
authKey: "password"
127+
128+
# -- if the JWKS url is set, the DelegatedAuth service will be engaged
129+
jwksUrl:
130+
127131
# -- control api, used for internal control calls. can be added to the internal ingress, but should probably not
128132
control:
129133
# -- port for incoming api calls

edc-controlplane/edc-controlplane-base/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ dependencies {
5757
runtimeOnly(libs.edc.core.policy.monitor)
5858
runtimeOnly(libs.edc.config.filesystem)
5959
runtimeOnly(libs.edc.auth.tokenbased)
60+
runtimeOnly(libs.edc.auth.delegated)
6061
runtimeOnly(libs.edc.auth.configuration)
6162
runtimeOnly(libs.edc.validator.data.address.http.data)
6263
runtimeOnly(libs.edc.aws.validator.data.address.s3)

gradle/libs.versions.toml

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ edc-api-controlplane = { module = "org.eclipse.edc:control-plane-api", version.r
8282
edc-dsp = { module = "org.eclipse.edc:dsp", version.ref = "edc" }
8383
edc-iam-mock = { module = "org.eclipse.edc:iam-mock", version.ref = "edc" }
8484
edc-auth-tokenbased = { module = "org.eclipse.edc:auth-tokenbased", version.ref = "edc" }
85+
edc-auth-delegated = { module = "org.eclipse.edc:auth-delegated", version.ref = "edc" }
8586
edc-auth-oauth2-client = { module = "org.eclipse.edc:oauth2-client", version.ref = "edc" }
8687
edc-auth-configuration = { module = "org.eclipse.edc:auth-configuration", version.ref = "edc" }
8788
edc-transaction-local = { module = "org.eclipse.edc:transaction-local", version.ref = "edc" }

samples/multi-tenancy/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ application {
4747

4848
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
4949
mergeServiceFiles()
50-
archiveFileName.set("multitenant.jar")
50+
archiveFileName.set("multi-tenancy.jar")
5151
}
5252

5353
// do not publish

0 commit comments

Comments
 (0)