From 1a554e65c0eb0d2072fbd807931e39f64c8020c3 Mon Sep 17 00:00:00 2001 From: Enrico Risa Date: Tue, 30 May 2023 17:13:52 +0200 Subject: [PATCH] feature: participant id configuration and extractor (#427) * Update Postman Collection for the version 0.4.0 * feat(Identity): add identity extractor from referringConnector * feat(Identity): updated charts * chore(protocol): switch default to /api/v1/dsp * chore(DataPlaneProxy): adds configuration for DataPlaneProxy * pr remarks * pr remarks * open api update * fix after review * fix after review --------- Co-authored-by: Tuncay Tunc (ZF Friedrichshafen AG) --- .../templates/deployment-controlplane.yaml | 40 +- .../templates/deployment-dataplane.yaml | 14 + .../templates/service-dataplane.yaml | 4 + .../values.yaml | 8 +- charts/tractusx-connector-memory/example.yaml | 4 + .../templates/deployment-runtime.yaml | 30 +- charts/tractusx-connector-memory/values.yaml | 8 +- .../templates/deployment-controlplane.yaml | 40 +- .../templates/deployment-dataplane.yaml | 14 + .../templates/service-dataplane.yaml | 5 + charts/tractusx-connector/values.yaml | 8 +- docs/development/postman/collection.json | 468 +++++++++--------- docs/migration/Version_0.3.4_0.4.0.md | 71 ++- .../build.gradle.kts | 4 + .../build.gradle.kts | 3 + edc-extensions/cx-oauth2/README.md | 14 + edc-extensions/cx-oauth2/build.gradle.kts | 2 + .../edc/oauth2/CxParticipantExtension.java | 75 +++ ...rg.eclipse.edc.spi.system.ServiceExtension | 1 + .../oauth2/CxParticipantExtensionTest.java | 90 ++++ .../AbstractHashicorpVaultExtension.java | 9 + .../HashicorpVaultHealthExtension.java | 22 +- .../HashicorpVaultVaultExtension.java | 18 +- .../HashicorpVaultExtensionTest.java | 49 +- ...ashicorpVaultHealthCheckExtensionTest.java | 86 ++-- ...tDefinition_Rename_selector_expression.sql | 15 + ...Process_Rename_transfer_process_column.sql | 15 + ...ovisionAdditionalHeadersExtensionTest.java | 4 +- .../tractusx-connector-azure-vault-test.yaml | 3 + .../helm/tractusx-connector-test.yaml | 4 + .../ContractDefinitionHelperFunctions.java | 4 +- .../edc/helpers/QueryHelperFunctions.java | 8 +- .../edc/lifecycle/PgParticipantRuntime.java | 22 +- .../lifecycle/TestRuntimeConfiguration.java | 5 +- gradle.properties | 6 +- gradle/libs.versions.toml | 2 +- .../yaml/control-plane-adapter-api.yaml | 28 +- .../edc-dataplane-proxy-consumer-api.yaml | 34 ++ .../edc-dataplane-proxy-provider-api.yaml | 12 + 39 files changed, 834 insertions(+), 415 deletions(-) create mode 100644 edc-extensions/cx-oauth2/src/main/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtension.java create mode 100644 edc-extensions/cx-oauth2/src/test/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtensionTest.java create mode 100644 edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/contractdefinition/V0_0_6__Alter_ContractDefinition_Rename_selector_expression.sql create mode 100644 edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/transferprocess/V0_0_10__Alter_TransferProcess_Rename_transfer_process_column.sql create mode 100644 resources/openapi/yaml/edc-dataplane-proxy-consumer-api.yaml create mode 100644 resources/openapi/yaml/edc-dataplane-proxy-provider-api.yaml diff --git a/charts/tractusx-connector-azure-vault/templates/deployment-controlplane.yaml b/charts/tractusx-connector-azure-vault/templates/deployment-controlplane.yaml index b5bd4968e..3a8ed5fd7 100644 --- a/charts/tractusx-connector-azure-vault/templates/deployment-controlplane.yaml +++ b/charts/tractusx-connector-azure-vault/templates/deployment-controlplane.yaml @@ -109,6 +109,12 @@ spec: {{- end }} {{- end }} + ######################## + ## ID CONFIGURATION ## + ######################## + - name: EDC_PARTICIPANT_ID + value: {{ .Values.participant.id | required ".Values.participant.id is required" | quote }} + ######################## ## DAPS CONFIGURATION ## ######################## @@ -154,31 +160,15 @@ spec: value: {{ .Values.controlplane.endpoints.observability.insecure | quote }} ######### - ## IDS ## + ## DSP ## ######### - - name: "IDS_WEBHOOK_ADDRESS" - value: {{ include "txdc.controlplane.url.protocol" . | quote }} - - name: "EDC_IDS_ENDPOINT" + + - name: "EDC_DSP_CALLBACK_ADDRESS" value: {{ printf "%s%s" (include "txdc.controlplane.url.protocol" .) .Values.controlplane.endpoints.protocol.path | quote }} - - name: "EDC_IDS_ID" - value: {{ printf "urn:connector:%s" (lower .Values.controlplane.internationalDataSpaces.id) | quote }} - - name: "EDC_IDS_DESCRIPTION" - value: {{ .Values.controlplane.internationalDataSpaces.description | quote }} - - name: "EDC_IDS_TITLE" - value: {{ .Values.controlplane.internationalDataSpaces.title | quote }} - - name: "EDC_IDS_MAINTAINER" - value: {{ .Values.controlplane.internationalDataSpaces.maintainer | quote }} - - name: "EDC_IDS_CURATOR" - value: {{ .Values.controlplane.internationalDataSpaces.curator | quote }} - - name: "EDC_IDS_CATALOG_ID" - value: {{ printf "urn:catalog:%s" (lower .Values.controlplane.internationalDataSpaces.catalogId) | quote }} - name: "EDC_OAUTH_PROVIDER_AUDIENCE" value: "idsc:IDS_CONNECTORS_ALL" - name: "EDC_OAUTH_ENDPOINT_AUDIENCE" - value: {{ printf "%s%s%s" (include "txdc.controlplane.url.protocol" . ) .Values.controlplane.endpoints.protocol.path "/data" | quote }} - # this is the old setting name for 'EDC_OAUTH_ENDPOINT_AUDIENCE' and is mandatory for Produce EDC v0.1.2 and older - - name: "EDC_IDS_ENDPOINT_AUDIENCE" - value: {{ printf "%s%s%s" (include "txdc.controlplane.url.protocol" . ) .Values.controlplane.endpoints.protocol.path "/data" | quote }} + value: {{ printf "%s%s" (include "txdc.controlplane.url.protocol" . ) .Values.controlplane.endpoints.protocol.path | quote }} ################ ## POSTGRESQL ## @@ -234,6 +224,16 @@ spec: - name: "EDC_DATASOURCE_TRANSFERPROCESS_URL" value: {{ .Values.postgresql.jdbcUrl | required ".Values.postgresql.jdbcUrl is required" | quote }} + # see extension https://github.com/eclipse-tractusx/tractusx-edc/tree/main/edc-extensions/edr-cache-sql + - name: "EDC_DATASOURCE_EDR_NAME" + value: "edr" + - name: "EDC_DATASOURCE_EDR_USER" + value: {{ .Values.postgresql.username | required ".Values.postgresql.username is required" | quote }} + - name: "EDC_DATASOURCE_EDR_PASSWORD" + value: {{ .Values.postgresql.password | required ".Values.postgresql.password is required" | quote }} + - name: "EDC_DATASOURCE_EDR_URL" + value: {{ .Values.postgresql.jdbcUrl | required ".Values.postgresql.jdbcUrl is required" | quote }} + ################ ## DATA PLANE ## ################ diff --git a/charts/tractusx-connector-azure-vault/templates/deployment-dataplane.yaml b/charts/tractusx-connector-azure-vault/templates/deployment-dataplane.yaml index a745e6778..468c1c2d9 100644 --- a/charts/tractusx-connector-azure-vault/templates/deployment-dataplane.yaml +++ b/charts/tractusx-connector-azure-vault/templates/deployment-dataplane.yaml @@ -147,6 +147,20 @@ spec: value: {{ .Values.dataplane.aws.accessKeyId | quote }} {{- end }} + ############### + ## EDR CACHE ## + ############### + + # see extension https://github.com/eclipse-tractusx/tractusx-edc/tree/main/edc-extensions/edr-cache-sql + - name: "EDC_DATASOURCE_EDR_NAME" + value: "edr" + - name: "EDC_DATASOURCE_EDR_USER" + value: {{ .Values.postgresql.username | required ".Values.postgresql.username is required" | quote }} + - name: "EDC_DATASOURCE_EDR_PASSWORD" + value: {{ .Values.postgresql.password | required ".Values.postgresql.password is required" | quote }} + - name: "EDC_DATASOURCE_EDR_URL" + value: {{ .Values.postgresql.jdbcUrl | required ".Values.postgresql.jdbcUrl is required" | quote }} + ########### ## VAULT ## ########### diff --git a/charts/tractusx-connector-azure-vault/templates/service-dataplane.yaml b/charts/tractusx-connector-azure-vault/templates/service-dataplane.yaml index 65df635da..179963fa8 100644 --- a/charts/tractusx-connector-azure-vault/templates/service-dataplane.yaml +++ b/charts/tractusx-connector-azure-vault/templates/service-dataplane.yaml @@ -48,5 +48,9 @@ spec: targetPort: metrics protocol: TCP name: metrics + - port: {{ .Values.dataplane.endpoints.proxy.port }} + targetPort: proxy + protocol: TCP + name: proxy selector: {{- include "txdc.dataplane.selectorLabels" . | nindent 4 }} diff --git a/charts/tractusx-connector-azure-vault/values.yaml b/charts/tractusx-connector-azure-vault/values.yaml index a2a80bcb3..d8b18b1bf 100644 --- a/charts/tractusx-connector-azure-vault/values.yaml +++ b/charts/tractusx-connector-azure-vault/values.yaml @@ -34,6 +34,9 @@ imagePullSecrets: [] customLabels: {} +participant: + id: "" + controlplane: image: # -- Which derivate of the control plane to use. when left empty the deployment will select the correct image automatically @@ -107,7 +110,7 @@ controlplane: # -- port for incoming api calls port: 8084 # -- path for incoming api calls - path: /api/v1/ids + path: /api/v1/dsp # -- metrics api, used for application metrics, must not be internet facing metrics: # -- port for incoming api calls @@ -340,6 +343,9 @@ dataplane: control: port: 8083 path: /api/dataplane/control + proxy: + port: 8186 + path: /proxy observability: # -- port for incoming API calls port: 8085 diff --git a/charts/tractusx-connector-memory/example.yaml b/charts/tractusx-connector-memory/example.yaml index 2eb672a74..0bf4f208a 100644 --- a/charts/tractusx-connector-memory/example.yaml +++ b/charts/tractusx-connector-memory/example.yaml @@ -32,6 +32,10 @@ --- fullnameOverride: tx-inmem + +participant: + id: "test-participant" + runtime: service: type: NodePort diff --git a/charts/tractusx-connector-memory/templates/deployment-runtime.yaml b/charts/tractusx-connector-memory/templates/deployment-runtime.yaml index 462a592d6..1896d5366 100644 --- a/charts/tractusx-connector-memory/templates/deployment-runtime.yaml +++ b/charts/tractusx-connector-memory/templates/deployment-runtime.yaml @@ -109,6 +109,12 @@ spec: {{- end }} {{- end }} + ######################## + ## ID CONFIGURATION ## + ######################## + - name: EDC_PARTICIPANT_ID + value: {{ .Values.participant.id | required ".Values.participant.id is required" | quote }} + ######################## ## DAPS CONFIGURATION ## ######################## @@ -175,31 +181,15 @@ spec: value: {{ include "txdc.runtime.url.validation" .}} ######### - ## IDS ## + ## DSP ## ######### - - name: "IDS_WEBHOOK_ADDRESS" - value: {{ include "txdc.runtime.url.protocol" . | quote }} - - name: "EDC_IDS_ENDPOINT" + + - name: "EDC_DSP_CALLBACK_ADDRESS" value: {{ printf "%s%s" (include "txdc.runtime.url.protocol" .) .Values.runtime.endpoints.protocol.path | quote }} - - name: "EDC_IDS_ID" - value: {{ printf "urn:connector:%s" (lower .Values.runtime.internationalDataSpaces.id) | quote }} - - name: "EDC_IDS_DESCRIPTION" - value: {{ .Values.runtime.internationalDataSpaces.description | quote }} - - name: "EDC_IDS_TITLE" - value: {{ .Values.runtime.internationalDataSpaces.title | quote }} - - name: "EDC_IDS_MAINTAINER" - value: {{ .Values.runtime.internationalDataSpaces.maintainer | quote }} - - name: "EDC_IDS_CURATOR" - value: {{ .Values.runtime.internationalDataSpaces.curator | quote }} - - name: "EDC_IDS_CATALOG_ID" - value: {{ printf "urn:catalog:%s" (lower .Values.runtime.internationalDataSpaces.catalogId) | quote }} - name: "EDC_OAUTH_PROVIDER_AUDIENCE" value: "idsc:IDS_CONNECTORS_ALL" - name: "EDC_OAUTH_ENDPOINT_AUDIENCE" - value: {{ printf "%s%s%s" (include "txdc.runtime.url.protocol" . ) .Values.runtime.endpoints.protocol.path "/data" | quote }} - # this is the old setting name for 'EDC_OAUTH_ENDPOINT_AUDIENCE' and is mandatory for Produce EDC v0.1.2 and older - - name: "EDC_IDS_ENDPOINT_AUDIENCE" - value: {{ printf "%s%s%s" (include "txdc.runtime.url.protocol" . ) .Values.runtime.endpoints.protocol.path "/data" | quote }} + value: {{ printf "%s%s" (include "txdc.runtime.url.protocol" . ) .Values.runtime.endpoints.protocol.path | quote }} ################ ## DATA PLANE ## diff --git a/charts/tractusx-connector-memory/values.yaml b/charts/tractusx-connector-memory/values.yaml index 7df670250..80fc6b5ed 100644 --- a/charts/tractusx-connector-memory/values.yaml +++ b/charts/tractusx-connector-memory/values.yaml @@ -31,6 +31,9 @@ imagePullSecrets: [] customLabels: {} +participant: + id: "" + runtime: image: repository: "" @@ -109,7 +112,7 @@ runtime: # -- port for incoming api calls port: 8084 # -- path for incoming api calls - path: /api/v1/ids + path: /api/v1/dsp # -- observability api with unsecured access, must not be internet facing observability: # -- port for incoming API calls @@ -121,6 +124,9 @@ runtime: public: port: 8086 path: /api/public + proxy: + port: 8186 + path: /proxy businessPartnerValidation: log: agreementValidation: true diff --git a/charts/tractusx-connector/templates/deployment-controlplane.yaml b/charts/tractusx-connector/templates/deployment-controlplane.yaml index 64e8fa5f8..ace56fcb1 100644 --- a/charts/tractusx-connector/templates/deployment-controlplane.yaml +++ b/charts/tractusx-connector/templates/deployment-controlplane.yaml @@ -109,6 +109,12 @@ spec: {{- end }} {{- end }} + ######################## + ## ID CONFIGURATION ## + ######################## + - name: EDC_PARTICIPANT_ID + value: {{ .Values.participant.id | required ".Values.participant.id is required" | quote }} + ######################## ## DAPS CONFIGURATION ## ######################## @@ -154,31 +160,15 @@ spec: value: {{ .Values.controlplane.endpoints.observability.insecure | quote }} ######### - ## IDS ## + ## DSP ## ######### - - name: "IDS_WEBHOOK_ADDRESS" - value: {{ include "txdc.controlplane.url.protocol" . | quote }} - - name: "EDC_IDS_ENDPOINT" + + - name: "EDC_DSP_CALLBACK_ADDRESS" value: {{ printf "%s%s" (include "txdc.controlplane.url.protocol" .) .Values.controlplane.endpoints.protocol.path | quote }} - - name: "EDC_IDS_ID" - value: {{ printf "urn:connector:%s" (lower .Values.controlplane.internationalDataSpaces.id) | quote }} - - name: "EDC_IDS_DESCRIPTION" - value: {{ .Values.controlplane.internationalDataSpaces.description | quote }} - - name: "EDC_IDS_TITLE" - value: {{ .Values.controlplane.internationalDataSpaces.title | quote }} - - name: "EDC_IDS_MAINTAINER" - value: {{ .Values.controlplane.internationalDataSpaces.maintainer | quote }} - - name: "EDC_IDS_CURATOR" - value: {{ .Values.controlplane.internationalDataSpaces.curator | quote }} - - name: "EDC_IDS_CATALOG_ID" - value: {{ printf "urn:catalog:%s" (lower .Values.controlplane.internationalDataSpaces.catalogId) | quote }} - name: "EDC_OAUTH_PROVIDER_AUDIENCE" value: "idsc:IDS_CONNECTORS_ALL" - name: "EDC_OAUTH_ENDPOINT_AUDIENCE" - value: {{ printf "%s%s%s" (include "txdc.controlplane.url.protocol" . ) .Values.controlplane.endpoints.protocol.path "/data" | quote }} - # this is the old setting name for 'EDC_OAUTH_ENDPOINT_AUDIENCE' and is mandatory for Produce EDC v0.1.2 and older - - name: "EDC_IDS_ENDPOINT_AUDIENCE" - value: {{ printf "%s%s%s" (include "txdc.controlplane.url.protocol" . ) .Values.controlplane.endpoints.protocol.path "/data" | quote }} + value: {{ printf "%s%s" (include "txdc.controlplane.url.protocol" . ) .Values.controlplane.endpoints.protocol.path | quote }} ################ ## POSTGRESQL ## @@ -234,6 +224,16 @@ spec: - name: "EDC_DATASOURCE_TRANSFERPROCESS_URL" value: {{ .Values.postgresql.jdbcUrl | required ".Values.postgresql.jdbcUrl is required" | quote }} + # see extension https://github.com/eclipse-tractusx/tractusx-edc/tree/main/edc-extensions/edr-cache-sql + - name: "EDC_DATASOURCE_EDR_NAME" + value: "edr" + - name: "EDC_DATASOURCE_EDR_USER" + value: {{ .Values.postgresql.username | required ".Values.postgresql.username is required" | quote }} + - name: "EDC_DATASOURCE_EDR_PASSWORD" + value: {{ .Values.postgresql.password | required ".Values.postgresql.password is required" | quote }} + - name: "EDC_DATASOURCE_EDR_URL" + value: {{ .Values.postgresql.jdbcUrl | required ".Values.postgresql.jdbcUrl is required" | quote }} + ################ ## DATA PLANE ## ################ diff --git a/charts/tractusx-connector/templates/deployment-dataplane.yaml b/charts/tractusx-connector/templates/deployment-dataplane.yaml index 5c6b28a1d..5a911dea2 100644 --- a/charts/tractusx-connector/templates/deployment-dataplane.yaml +++ b/charts/tractusx-connector/templates/deployment-dataplane.yaml @@ -147,6 +147,20 @@ spec: value: {{ .Values.dataplane.aws.accessKeyId | quote }} {{- end }} + ############### + ## EDR CACHE ## + ############### + + # see extension https://github.com/eclipse-tractusx/tractusx-edc/tree/main/edc-extensions/edr-cache-sql + - name: "EDC_DATASOURCE_EDR_NAME" + value: "edr" + - name: "EDC_DATASOURCE_EDR_USER" + value: {{ .Values.postgresql.username | required ".Values.postgresql.username is required" | quote }} + - name: "EDC_DATASOURCE_EDR_PASSWORD" + value: {{ .Values.postgresql.password | required ".Values.postgresql.password is required" | quote }} + - name: "EDC_DATASOURCE_EDR_URL" + value: {{ .Values.postgresql.jdbcUrl | required ".Values.postgresql.jdbcUrl is required" | quote }} + ########### ## VAULT ## ########### diff --git a/charts/tractusx-connector/templates/service-dataplane.yaml b/charts/tractusx-connector/templates/service-dataplane.yaml index 07ee9cba3..14c2181b7 100644 --- a/charts/tractusx-connector/templates/service-dataplane.yaml +++ b/charts/tractusx-connector/templates/service-dataplane.yaml @@ -51,5 +51,10 @@ spec: targetPort: metrics protocol: TCP name: metrics + - port: {{ .Values.dataplane.endpoints.proxy.port }} + targetPort: proxy + protocol: TCP + name: proxy + selector: {{- include "txdc.dataplane.selectorLabels" . | nindent 4 }} diff --git a/charts/tractusx-connector/values.yaml b/charts/tractusx-connector/values.yaml index e2bb1a692..4a0834737 100644 --- a/charts/tractusx-connector/values.yaml +++ b/charts/tractusx-connector/values.yaml @@ -34,6 +34,9 @@ imagePullSecrets: [] customLabels: {} +participant: + id: "" + controlplane: image: # -- Which derivate of the control plane to use. when left empty the deployment will select the correct image automatically @@ -107,7 +110,7 @@ controlplane: # -- port for incoming api calls port: 8084 # -- path for incoming api calls - path: /api/v1/ids + path: /api/v1/dsp # -- metrics api, used for application metrics, must not be internet facing metrics: # -- port for incoming api calls @@ -340,6 +343,9 @@ dataplane: control: port: 8083 path: /api/dataplane/control + proxy: + port: 8186 + path: /proxy observability: # -- port for incoming API calls port: 8085 diff --git a/docs/development/postman/collection.json b/docs/development/postman/collection.json index 26de5c7d2..ee601cb08 100644 --- a/docs/development/postman/collection.json +++ b/docs/development/postman/collection.json @@ -1,48 +1,13 @@ { "info": { - "_postman_id": "fcea09d2-13d9-49ce-8c44-d3cb3078eb82", - "name": "EDC", + "_postman_id": "64e409d9-3fd0-4b85-8de9-df1094a58400", + "name": "tractusx-edc_dsp", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "6134257" + "_exporter_id": "27652630" }, "item": [ { - "name": "Asset", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/assets/{{ASSET_ID}}", - "host": [ - "{{PROVIDER_MANAGEMENT_URL}}" - ], - "path": [ - "assets", - "{{ASSET_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "Assets", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/assets", - "host": [ - "{{PROVIDER_MANAGEMENT_URL}}" - ], - "path": [ - "assets" - ] - } - }, - "response": [] - }, - { - "name": "Asset", + "name": "Create Asset", "event": [ { "listen": "test", @@ -61,7 +26,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"asset\": {\n \"properties\": {\n \"asset:prop:id\": \"{{ASSET_ID}}\",\n \"asset:prop:description\": \"Tractus-X EDC Demo Asset\"\n }\n },\n \"dataAddress\": {\n \"properties\": {\n \"type\": \"HttpData\",\n \"baseUrl\": \"https://jsonplaceholder.typicode.com/todos/1\"\n }\n }\n}", + "raw": "{\n \"@context\": {},\n \"asset\": {\n \"@type\": \"Asset\",\n \"@id\": \"{{ASSET_ID}}\", \n \"properties\": {\n \"description\": \"Product EDC Demo Asset\"\n }\n },\n \"dataAddress\": {\n \"@type\": \"DataAddress\",\n \"type\": \"HttpData\",\n \"baseUrl\": \"https://jsonplaceholder.typicode.com/todos\"\n }\n}", "options": { "raw": { "language": "json" @@ -81,90 +46,67 @@ "response": [] }, { - "name": "Asset", + "name": "Get all Assets", "request": { - "method": "DELETE", + "method": "POST", "header": [], "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/assets/{{ASSET_ID}}", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/assets/request", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ "assets", - "{{ASSET_ID}}" + "request" ] } }, "response": [] }, { - "name": "Policy", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, + "name": "Get Asset by ID", "request": { "method": "GET", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": []\n }\n ]\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/policydefinitions/{{POLICY_ID}}", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/assets/{{ASSET_ID}}", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ - "policydefinitions", - "{{POLICY_ID}}" + "assets", + "{{ASSET_ID}}" ] } }, "response": [] }, { - "name": "Policies", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, + "name": "Delete Asset by ID", "request": { - "method": "GET", + "method": "DELETE", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": []\n }\n ]\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/policydefinitions", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/assets/{{ASSET_ID}}", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ - "policydefinitions" + "assets", + "{{ASSET_ID}}" ] } }, "response": [] }, { - "name": "Policy (Public)", + "name": "Create Policy", "request": { "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": []\n }\n ]\n }\n}", + "raw": "{\n \"@context\": {\n \"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n },\n \"@type\": \"PolicyDefinitionRequestDto\",\n \"@id\": \"{{POLICY_ID}}\",\n \"policy\": {\n\t\t\"@type\": \"Policy\",\n\t\t\"odrl:permission\" : [{\n\t\t\t\"odrl:action\" : \"USE\",\n\t\t\t\"odrl:constraint\" : {\n\t\t\t\t\"@type\": \"LogicalConstraint\",\n\t\t\t\t\"odrl:or\" : [{\n\t\t\t\t\t\"@type\" : \"Constraint\",\n\t\t\t\t\t\"odrl:leftOperand\" : \"BusinessPartnerNumber\",\n\t\t\t\t\t\"odrl:operator\" : \"EQ\",\n\t\t\t\t\t\"odrl:rightOperand\" : \"{{POLICY_BPN}}\"\n\t\t\t\t}]\n\t\t\t}\n\t\t}]\n }\n}", "options": { "raw": { "language": "json" @@ -184,13 +126,16 @@ "response": [] }, { - "name": "Policy (Properties)", + "name": "Get Policy by ID", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { - "method": "POST", + "method": "GET", "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": []\n }\n ],\n \"extensibleProperties\": {\n \"foo\": \"bar\"\n }\n }\n}", + "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": []\n }\n ]\n }\n}", "options": { "raw": { "language": "json" @@ -198,25 +143,26 @@ } }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/policydefinitions", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/policydefinitions/{{POLICY_ID}}", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ - "policydefinitions" + "policydefinitions", + "{{POLICY_ID}}" ] } }, "response": [] }, { - "name": "Policy (BPN)", + "name": "Get all Policies", "request": { "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": [\n {\n \"edctype\": \"AtomicConstraint\",\n \"leftExpression\": {\n \"edctype\": \"dataspaceconnector:literalexpression\",\n \"value\": \"BusinessPartnerNumber\"\n },\n \"rightExpression\": {\n \"edctype\": \"dataspaceconnector:literalexpression\",\n \"value\": \"{{POLICY_BPN}}\"\n },\n \"operator\": \"EQ\"\n }\n ]\n }\n ]\n }\n}", + "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": []\n }\n ]\n }\n}", "options": { "raw": { "language": "json" @@ -224,19 +170,20 @@ } }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/policydefinitions", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/policydefinitions/request", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ - "policydefinitions" + "policydefinitions", + "request" ] } }, "response": [] }, { - "name": "Policy", + "name": "Delte Policy by ID", "request": { "method": "DELETE", "header": [], @@ -263,16 +210,13 @@ "response": [] }, { - "name": "Contract Definition", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, + "name": "Create Contract Definitiion", "request": { - "method": "GET", + "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"{{POLICY_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"constraints\": []\n }\n ]\n }\n}", + "raw": "{\n \"@context\": {},\n \"@id\": \"{{CONTRACT_DEFINITION_ID}}\",\n \"@type\": \"ContractDefinition\",\n \"accessPolicyId\": \"{{ACCESS_POLICY_ID}}\",\n \"contractPolicyId\": \"{{CONTRACT_POLICY_ID}}\",\n \"assetsSelector\" : {\n \"@type\" : \"CriterionDto\",\n \"operandLeft\": \"{{EDC_NAMESPACE}}id\",\n \"operator\": \"=\",\n \"operandRight\": \"{{ASSET_ID}}\"\n }\n}", "options": { "raw": { "language": "json" @@ -280,20 +224,19 @@ } }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions/{{POLICY_ID}}", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ - "contractdefinitions", - "{{POLICY_ID}}" + "contractdefinitions" ] } }, "response": [] }, { - "name": "Contract Definitiions", + "name": "Get Contract Definition by ID", "protocolProfileBehavior": { "disableBodyPruning": true }, @@ -310,25 +253,26 @@ } }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions/{{CONTRACT_DEFINITION_ID}}", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ - "contractdefinitions" + "contractdefinitions", + "{{CONTRACT_DEFINITION_ID}}" ] } }, "response": [] }, { - "name": "Contract Definitiion", + "name": "Get all Contract Definitiions", "request": { "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n \"id\": \"{{CONTRACT_DEFINITION_ID}}\",\n \"criteria\": [\n {\n \"operandLeft\": \"asset:prop:id\",\n \"operator\": \"=\",\n \"operandRight\": \"{{ASSET_ID}}\"\n }\n ],\n \"accessPolicyId\": \"{{ACCESS_POLICY_ID}}\",\n \"contractPolicyId\": \"{{CONTRACT_POLICY_ID}}\"\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -336,19 +280,20 @@ } }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions/request", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ - "contractdefinitions" + "contractdefinitions", + "request" ] } }, "response": [] }, { - "name": "Contract Definition", + "name": "Delte Contract Definition", "request": { "method": "DELETE", "header": [], @@ -362,40 +307,13 @@ } }, "url": { - "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions/{{POLICY_ID}}", + "raw": "{{PROVIDER_MANAGEMENT_URL}}/contractdefinitions/{{CONTRACT_DEFINITION_ID}}", "host": [ "{{PROVIDER_MANAGEMENT_URL}}" ], "path": [ "contractdefinitions", - "{{POLICY_ID}}" - ] - } - }, - "response": [] - }, - { - "name": "Catalog", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/catalog?providerUrl={{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data&size=50", - "host": [ - "{{CONSUMER_MANAGEMENT_URL}}" - ], - "path": [ - "catalog" - ], - "query": [ - { - "key": "providerUrl", - "value": "{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data" - }, - { - "key": "size", - "value": "50" - } + "{{CONTRACT_DEFINITION_ID}}" ] } }, @@ -408,7 +326,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"providerUrl\": \"{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data\",\r\n \"querySpec\": {\r\n \"offset\": 0,\r\n \"limit\": 100,\r\n \"sort\": \"ASC\",\r\n \"sortField\": \"\"\r\n }\r\n}", + "raw": "{\r\n \"@context\": {},\r\n \"protocol\": \"dataspace-protocol-http\",\r\n \"providerUrl\": \"{{PROVIDER_PROTOCOL_URL}}\",\r\n \"querySpec\": {\r\n \"offset\": 0,\r\n \"limit\": 100,\r\n \"filter\": \"\",\r\n \"range\": {\r\n \"from\": 0,\r\n \"to\": 100\r\n },\r\n \"sortField\": \"\",\r\n \"criterion\": \"\"\r\n }\r\n}", "options": { "raw": { "language": "json" @@ -429,7 +347,7 @@ "response": [] }, { - "name": "Negotation (Public)", + "name": "Initiate Negotation", "event": [ { "listen": "test", @@ -450,7 +368,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"connectorId\": \"foo\",\n \"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data\",\n \"offer\": {\n \"offerId\": \"{{CONTRACT_DEFINITION_ID}}:foo\",\n \"assetId\": \"{{ASSET_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"target\": \"{{ASSET_ID}}\",\n \"constraints\": []\n }\n ]\n }\n }\n}", + "raw": "{\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n\t},\n\t\"@type\": \"NegotiationInitiateRequestDto\",\n\t\"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}\",\n\t\"protocol\": \"dataspace-protocol-http\",\n\t\"connectorId\": \"{{PROVIDER_ID}}\",\n\t\"providerId\": \"{{PROVIDER_ID}}\",\n\t\"offer\": {\n\t\t\"offerId\": \"1:1:46483724-18f1-4dff-87da-f26725dcc59c\",\n\t\t\"assetId\": \"{{ASSET_ID}}\",\n\t\t\"policy\": {\n\t\t\t\"@type\": \"odrl:Set\",\n\t\t\t\"odrl:permission\": {\n\t\t\t\t\"odrl:target\": \"{{ASSET_ID}}\",\n\t\t\t\t\"odrl:action\": {\n\t\t\t\t\t\"odrl:type\": \"USE\"\n\t\t\t\t},\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"odrl:or\": {\n\t\t\t\t\t\t\"odrl:leftOperand\": \"BusinessPartnerNumber\",\n\t\t\t\t\t\t\"odrl:operator\": \"EQ\",\n\t\t\t\t\t\t\"odrl:rightOperand\": \"{{POLICY_BPN}}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"odrl:prohibition\": [],\n\t\t\t\"odrl:obligation\": [],\n\t\t\t\"odrl:target\": \"{{ASSET_ID}}\"\n\t\t}\n\t}\n}", "options": { "raw": { "language": "json" @@ -470,17 +388,22 @@ "response": [] }, { - "name": "Negotation (Properties)", + "name": "Get all Negotations", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, { "listen": "test", "script": { "exec": [ - "pm.test(\"Body matches string\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"NEGOTIATION_ID\", jsonData.id);", - "", - "});" + "" ], "type": "text/javascript" } @@ -489,38 +412,77 @@ "request": { "method": "POST", "header": [], - "body": { - "mode": "raw", - "raw": "{\n \"connectorId\": \"foo\",\n \"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data\",\n \"offer\": {\n \"offerId\": \"{{POLICY_ID}}:foo\",\n \"assetId\": \"{{ASSET_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"target\": \"{{ASSET_ID}}\",\n \"constraints\": []\n }\n ],\n \"extensibleProperties\": {\n \"foo\": \"bar\"\n }\n }\n }\n}", - "options": { - "raw": { - "language": "json" - } + "url": { + "raw": "{{CONSUMER_MANAGEMENT_URL}}/contractnegotiations/request", + "host": [ + "{{CONSUMER_MANAGEMENT_URL}}" + ], + "path": [ + "contractnegotiations", + "request" + ] + } + }, + "response": [] + }, + { + "name": "Cancel Negotation by ID", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" } }, + { + "listen": "test", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/contractnegotiations", + "raw": "{{CONSUMER_MANAGEMENT_URL}}/contractnegotiations/7cff6ecb-7e5e-40b8-b101-eba3f2045b1f/cancel", "host": [ "{{CONSUMER_MANAGEMENT_URL}}" ], "path": [ - "contractnegotiations" + "contractnegotiations", + "7cff6ecb-7e5e-40b8-b101-eba3f2045b1f", + "cancel" ] } }, "response": [] }, { - "name": "Negotation (BPN)", + "name": "Initiate Transfer", "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"TRANSFER_ID\", Math.random());" + ], + "type": "text/javascript" + } + }, { "listen": "test", "script": { "exec": [ "pm.test(\"Body matches string\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"NEGOTIATION_ID\", jsonData.id);", - "", + " pm.collectionVariables.set(\"TRANSFER_PROCESS_ID\", jsonData.id);", "});" ], "type": "text/javascript" @@ -532,7 +494,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"connectorId\": \"foo\",\n \"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data\",\n \"offer\": {\n \"offerId\": \"{{POLICY_ID}}:foo\",\n \"assetId\": \"{{ASSET_ID}}\",\n \"policy\": {\n \"prohibitions\": [],\n \"obligations\": [],\n \"permissions\": [\n {\n \"edctype\": \"dataspaceconnector:permission\",\n \"action\": {\n \"type\": \"USE\"\n },\n \"target\": \"{{ASSET_ID}}\",\n \"constraints\": [\n {\n \"edctype\": \"AtomicConstraint\",\n \"leftExpression\": {\n \"edctype\": \"dataspaceconnector:literalexpression\",\n \"value\": \"BusinessPartnerNumber\"\n },\n \"rightExpression\": {\n \"edctype\": \"dataspaceconnector:literalexpression\",\n \"value\": \"{{POLICY_BPN}}\"\n },\n \"operator\": \"EQ\"\n }\n ]\n }\n ]\n }\n }\n}", + "raw": "{\n \"@context\": {\n \"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n },\n \"assetId\": \"{{ASSET_ID}}\",\n \"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}\",\n \"contractId\": \"1:1:e79ddbda-8317-4644-ba8d-70d07298284a\",\n \"dataDestination\": {\n \"properties\": {\n \"type\": \"HttpProxy\"\n }\n },\n \"managedResources\": false,\n \"privateProperties\": {\n \"receiverHttpEndpoint\": \"{{BACKEND_SERVICE}}\"\n },\n \"protocol\": \"dataspace-protocol-http\",\n \"transferType\": {\n \"contentType\": \"application/octet-stream\",\n \"isFinite\": true\n }\n}", "options": { "raw": { "language": "json" @@ -540,19 +502,19 @@ } }, "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/contractnegotiations", + "raw": "{{CONSUMER_MANAGEMENT_URL}}/transferprocesses", "host": [ "{{CONSUMER_MANAGEMENT_URL}}" ], "path": [ - "contractnegotiations" + "transferprocesses" ] } }, "response": [] }, { - "name": "Negotation (init AGREEMENT_ID)", + "name": "Get Transfer by ID", "event": [ { "listen": "prerequest", @@ -567,10 +529,7 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"Body matches string\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.collectionVariables.set(\"AGREEMENT_ID\", jsonData.contractAgreementId);\r", - "});" + "" ], "type": "text/javascript" } @@ -580,26 +539,26 @@ "method": "GET", "header": [], "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/contractnegotiations/{{NEGOTIATION_ID}}", + "raw": "{{CONSUMER_MANAGEMENT_URL}}/transferprocesses/8e428b80-46a5-4325-87e5-592518f7666b", "host": [ "{{CONSUMER_MANAGEMENT_URL}}" ], "path": [ - "contractnegotiations", - "{{NEGOTIATION_ID}}" + "transferprocesses", + "8e428b80-46a5-4325-87e5-592518f7666b" ] } }, "response": [] }, { - "name": "Transfer", + "name": "Get all Transfers", "event": [ { "listen": "prerequest", "script": { "exec": [ - "pm.collectionVariables.set(\"TRANSFER_ID\", Math.random());" + "" ], "type": "text/javascript" } @@ -608,10 +567,7 @@ "listen": "test", "script": { "exec": [ - "pm.test(\"Body matches string\", function () {", - " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"TRANSFER_PROCESS_ID\", jsonData.id);", - "});" + "" ], "type": "text/javascript" } @@ -622,7 +578,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{ \"id\": \"{{TRANSFER_ID}}\",\n \"connectorId\": \"foo\", \n \"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data\", \n \"contractId\": \"{{AGREEMENT_ID}}\", \n \"assetId\": \"{{ASSET_ID}}\",\n \"managedResources\": \"false\", \n \"dataDestination\": { \"type\": \"HttpProxy\" }\n}", + "raw": "{}", "options": { "raw": { "language": "json" @@ -630,36 +586,29 @@ } }, "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/transferprocess", + "raw": "{{CONSUMER_MANAGEMENT_URL}}/transferprocesses/request", "host": [ "{{CONSUMER_MANAGEMENT_URL}}" ], "path": [ - "transferprocess" + "transferprocesses", + "request" ] } }, "response": [] }, { - "name": "Transfer dynamic http receiver", + "name": "Initiate EDR Negotation", "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "pm.collectionVariables.set(\"TRANSFER_ID\", Math.random());" - ], - "type": "text/javascript" - } - }, { "listen": "test", "script": { "exec": [ "pm.test(\"Body matches string\", function () {", " var jsonData = pm.response.json();", - " pm.collectionVariables.set(\"TRANSFER_PROCESS_ID\", jsonData.id);", + " pm.collectionVariables.set(\"NEGOTIATION_ID\", jsonData.id);", + "", "});" ], "type": "text/javascript" @@ -671,7 +620,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{ \"id\": \"{{TRANSFER_ID}}\",\n \"connectorId\": \"foo\", \n \"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data\", \n \"contractId\": \"{{AGREEMENT_ID}}\", \n \"assetId\": \"{{ASSET_ID}}\",\n \"managedResources\": \"false\", \n \"dataDestination\": { \"type\": \"HttpProxy\" },\n \"properties\": {\n \"receiver.http.endpoint\": \"{{BACKEND_SERVICE}}\"\n }\n}", + "raw": "{\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n\t},\n\t\"@type\": \"NegotiationInitiateRequestDto\",\n\t\"connectorAddress\": \"{{PROVIDER_PROTOCOL_URL}}\",\n\t\"protocol\": \"dataspace-protocol-http\",\n\t\"connectorId\": \"{{PROVIDER_ID}}\",\n\t\"providerId\": \"{{PROVIDER_ID}}\",\n\t\"offer\": {\n\t\t\"offerId\": \"1:1:9f9375e3-ed28-449a-8a98-a340f4c20c26\",\n\t\t\"assetId\": \"{{ASSET_ID}}\",\n\t\t\"policy\": {\n\t\t\t\"@type\": \"odrl:Set\",\n\t\t\t\"odrl:permission\": {\n\t\t\t\t\"odrl:target\": \"{{ASSET_ID}}\",\n\t\t\t\t\"odrl:action\": {\n\t\t\t\t\t\"odrl:type\": \"USE\"\n\t\t\t\t},\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"odrl:or\": {\n\t\t\t\t\t\t\"odrl:leftOperand\": \"BusinessPartnerNumber\",\n\t\t\t\t\t\t\"odrl:operator\": \"EQ\",\n\t\t\t\t\t\t\"odrl:rightOperand\": \"{{POLICY_BPN}}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"odrl:prohibition\": [],\n\t\t\t\"odrl:obligation\": [],\n\t\t\t\"odrl:target\": \"{{ASSET_ID}}\"\n\t\t}\n\t}\n}", "options": { "raw": { "language": "json" @@ -679,65 +628,123 @@ } }, "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/transferprocess", + "raw": "{{CONSUMER_ADAPTER_URL}}/edrs", "host": [ - "{{CONSUMER_MANAGEMENT_URL}}" + "{{CONSUMER_ADAPTER_URL}}" ], "path": [ - "transferprocess" + "edrs" ] } }, "response": [] }, { - "name": "Transfer", + "name": "Query EDRs Cached", "event": [ { - "listen": "prerequest", + "listen": "test", "script": { "exec": [ - "" + "pm.test(\"Body matches string\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"NEGOTIATION_ID\", jsonData.id);", + "", + "});" ], "type": "text/javascript" } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } }, + "url": { + "raw": "{{CONSUMER_ADAPTER_URL}}/edrs?assetId={{ASSET_ID}}", + "host": [ + "{{CONSUMER_ADAPTER_URL}}" + ], + "path": [ + "edrs" + ], + "query": [ + { + "key": "assetId", + "value": "{{ASSET_ID}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Get EDR by tp ID", + "event": [ { "listen": "test", "script": { "exec": [ - "" + "pm.test(\"Body matches string\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"NEGOTIATION_ID\", jsonData.id);", + "", + "});" ], "type": "text/javascript" } } ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/transferprocess/{{TRANSFER_PROCESS_ID}}", + "raw": "{{CONSUMER_ADAPTER_URL}}/edrs/4b383155-9147-4912-819e-6172b4a3eb02", "host": [ - "{{CONSUMER_MANAGEMENT_URL}}" + "{{CONSUMER_ADAPTER_URL}}" ], "path": [ - "transferprocess", - "{{TRANSFER_PROCESS_ID}}" + "edrs", + "4b383155-9147-4912-819e-6172b4a3eb02" ] } }, "response": [] }, { - "name": "CPA (getData)", + "name": "Get Asset Data with proxy", "event": [ { "listen": "test", "script": { "exec": [ - "pm.test(\"Body matches string\", function () {\r", - " var jsonData = pm.response.json();\r", - " pm.collectionVariables.set(\"authCode\", jsonData.authCode);\r", + "pm.test(\"Body matches string\", function () {", + " var jsonData = pm.response.json();", + " pm.collectionVariables.set(\"NEGOTIATION_ID\", jsonData.id);", + "", "});" ], "type": "text/javascript" @@ -745,28 +752,28 @@ } ], "request": { - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"assetId\": \"{{ASSET_ID}}\",\n \"endpointUrl\": \"http://plato-dataplane:8080/api/gateway/aas/1\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{CONSUMER_MANAGEMENT_URL}}/adapter/asset/sync/{{ASSET_ID}}?providerUrl={{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data&contractAgreementReuse=false", + "raw": "http://localhost:8186/proxy/aas/request", + "protocol": "http", "host": [ - "{{CONSUMER_MANAGEMENT_URL}}" + "localhost" ], + "port": "8186", "path": [ - "adapter", - "asset", - "sync", - "{{ASSET_ID}}" - ], - "query": [ - { - "key": "providerUrl", - "value": "{{PROVIDER_PROTOCOL_URL}}/api/v1/ids/data" - }, - { - "key": "contractAgreementReuse", - "value": "false" - } + "proxy", + "aas", + "request" ] } }, @@ -778,7 +785,7 @@ "apikey": [ { "key": "value", - "value": "", + "value": "password", "type": "string" }, { @@ -811,15 +818,15 @@ "variable": [ { "key": "CONSUMER_MANAGEMENT_URL", - "value": "https://sokrates-txdc.int.demo.catena-x.net/management" + "value": "http://localhost:31364/management/v2" }, { "key": "PROVIDER_PROTOCOL_URL", - "value": "https://plato-txdc.int.demo.catena-x.net" + "value": "http://plato-controlplane:8084/api/v1/dsp\n" }, { "key": "PROVIDER_MANAGEMENT_URL", - "value": "https://plato-txdc.int.demo.catena-x.net/management" + "value": "http://localhost:30279/management/v2" }, { "key": "ASSET_ID", @@ -879,6 +886,21 @@ { "key": "authCode", "value": "" + }, + { + "key": "PROVIDER_ID", + "value": "BPNPLATO", + "type": "string" + }, + { + "key": "EDC_NAMESPACE", + "value": "https://w3id.org/edc/v0.0.1/ns/", + "type": "string" + }, + { + "key": "CONSUMER_ADAPTER_URL", + "value": "http://localhost:31364/management/adapter", + "type": "string" } ] } \ No newline at end of file diff --git a/docs/migration/Version_0.3.4_0.4.0.md b/docs/migration/Version_0.3.4_0.4.0.md index cca287921..5090fc137 100644 --- a/docs/migration/Version_0.3.4_0.4.0.md +++ b/docs/migration/Version_0.3.4_0.4.0.md @@ -1,4 +1,4 @@ -# Migration from 0.3.3 to 0.3.4 +# Migration from 0.3.4 to 0.4.0 ## Switching to DSP @@ -10,9 +10,16 @@ From the Tractus-X EDC perspective this causes breaking changes in the following The old Management API is now deprecated and is **not** tested for compliance. Please upgrade using the `/v2/` path for every endpoint, e.g. `/management/v2/assets`. Please also refer to the [EDC OpenAPI spec](https://app.swaggerhub.com/apis/eclipse-edc-bot/management-api/0.0.1-SNAPSHOT#/). + An updated postman collection with the `v2` flow is available [here](../development/postman/collection.json) + - modules: all `*ids*` modules are deprecated and cannot be used anymore. Please migrate over to `org.eclipse.edc:dsp:0.0.1-milestone-9`. +- path: the default protocol path is now `/api/v1/dsp` instead of `/api/v1/ids` + +- `edc.participant.id`: new mandatory configuration for the participant id in the dataspace (BPN number). + It's configured via mandatory property in the charts with object ```yaml participant: id: "id"```. + **Please note that this is not a complete documentation of the DSP Protocol, please refer to the [official documentation](https://docs.internationaldataspaces.org/dataspace-protocol/overview/readme)** @@ -27,3 +34,65 @@ The Business tests were brittle, consumed a lot of resources and were quite cumb Since the old Control-Plane-Adapter is incompatible with DSP, a new iteration was created. **Due to time constraints with this release documentation for this feature will to be published subsequently** + +## New Policies for expressing validity of the agreement + +The dates in `ContractOffer` and `ContractAgreement` has been removed in favour of a policy based contract validity check, see [here](https://github.com/eclipse-edc/Connector/issues/2758) + +## Other changes + +- When using the EDR [HttpDynamicReceiverExtension](https://github.com/eclipse-edc/Connector/tree/main/extensions/control-plane/transfer/transfer-pull-http-dynamic-receiver) in the transfer process initiation + the properties for configuring the receiver on single transfer process has been changed to: + + ```json + "privateProperties": { + "receiverHttpEndpoint": "{{BACKEND_SERVICE}}" + } + ``` + + instead of: + + ```json + "properties": { + "receiver.http.endpoint": "{{BACKEND_SERVICE}}" + } + ``` + +## New Catalog + +The DSP catalog is expressed as [DCat Catalog](https://www.w3.org/TR/vocab-dcat-3/), when querying the catalog a response like this will return: + +```json +{ + "@id": "5a3207ae-bd0d-4a3b-bc8a-05adfbe75d95", + "@type": "dcat:Catalog", + "dcat:dataset": { + "@id": "e6279569-17a9-4ba3-9401-a8ae4100e4eb", + "@type": "dcat:Dataset", + "odrl:hasPolicy": { + "@id": "2:1:535def6e-8321-4c0e-a595-aabdd9c18eed", + "@type": "odrl:Set", + "odrl:permission": [], + "odrl:prohibition": [], + "odrl:obligation": [], + "odrl:target": "1" + }, + "dcat:distribution": [ + ... + ], + "edc:description": "Product EDC Demo Asset", + "edc:id": "1" + }, + "dcat:service": { + ... + }, + "edc:participantId": "participantId", + "@context": { + } +} +``` + +When starting a new contract negotiation for an asset: + +- the `@id` of `odrl:hasPolicy` object should be passed in the `offerId` field +- the `edc:participantId` should be passed in the `providerId` and `connectorId` fields. `connectorId` it's still needed for backward compatibility and it will probably be removed in the next versions. diff --git a/edc-dataplane/edc-dataplane-azure-vault/build.gradle.kts b/edc-dataplane/edc-dataplane-azure-vault/build.gradle.kts index 9a2b323ca..43f401bb8 100644 --- a/edc-dataplane/edc-dataplane-azure-vault/build.gradle.kts +++ b/edc-dataplane/edc-dataplane-azure-vault/build.gradle.kts @@ -33,6 +33,10 @@ dependencies { } implementation(libs.edc.azure.identity) implementation("com.azure:azure-security-keyvault-secrets:4.6.2") + runtimeOnly(project(":edc-extensions:edr-cache-sql")) + runtimeOnly(libs.edc.transaction.local) + runtimeOnly(libs.edc.sql.pool) + runtimeOnly(libs.postgres) } tasks.withType { diff --git a/edc-dataplane/edc-dataplane-hashicorp-vault/build.gradle.kts b/edc-dataplane/edc-dataplane-hashicorp-vault/build.gradle.kts index 682c9b214..247744df2 100644 --- a/edc-dataplane/edc-dataplane-hashicorp-vault/build.gradle.kts +++ b/edc-dataplane/edc-dataplane-hashicorp-vault/build.gradle.kts @@ -27,6 +27,9 @@ dependencies { implementation(project(":edc-dataplane:edc-dataplane-base")) implementation(project(":edc-extensions:hashicorp-vault")) runtimeOnly(project(":edc-extensions:edr-cache-sql")) + runtimeOnly(libs.edc.transaction.local) + runtimeOnly(libs.edc.sql.pool) + runtimeOnly(libs.postgres) } tasks.withType { diff --git a/edc-extensions/cx-oauth2/README.md b/edc-extensions/cx-oauth2/README.md index 479c783c7..f9ca70637 100644 --- a/edc-extensions/cx-oauth2/README.md +++ b/edc-extensions/cx-oauth2/README.md @@ -31,3 +31,17 @@ Instead of the `idsc:IDS_CONNECTORS_ALL` the connector requests a specific audie When a connector receives a message, it will checks the token audience is equal to the configured value in `edc.ids.endpoint.audience`. ![sequence diagram](./diagrams/sequence.png) + +## Catena-X Participant Extension + +Starting from `0.0.1-milestone-9` EDC requires a mandatory setting `edc.participant.id`, which in this case should be the BPN number which is transmitted over the wire to identifying the participants IDs. +To verify that in the DAPS token an extension has been created, that extract from the `ClaimToken` the BPN number and then EDC compare that identity with the one provided over the wire, for security reason. + +By default the extension parse the `referringConnector` url and extract the BPN number as the last parameter in the URL eg (http://sokrates-controlplane/BPNSOKRATES). + +### Configuration + +| Key | Description | Mandatory | Default | +|:--------------------------------------|:----------------------------------------------------------|-----------|---------------| +| tx.participant.id.regex | Regex for extracting the BPN from the referringConnector | | [^/]+(?=/$|$) | +| tx.participant.id.regexGroup | Group number for the regex match | | 0 | diff --git a/edc-extensions/cx-oauth2/build.gradle.kts b/edc-extensions/cx-oauth2/build.gradle.kts index 16d6219ae..772c60f47 100644 --- a/edc-extensions/cx-oauth2/build.gradle.kts +++ b/edc-extensions/cx-oauth2/build.gradle.kts @@ -30,4 +30,6 @@ dependencies { implementation(libs.slf4j.api) implementation(libs.nimbus.jwt) implementation(libs.okhttp) + + testImplementation(libs.edc.junit) } diff --git a/edc-extensions/cx-oauth2/src/main/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtension.java b/edc-extensions/cx-oauth2/src/main/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtension.java new file mode 100644 index 000000000..037851bcd --- /dev/null +++ b/edc-extensions/cx-oauth2/src/main/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtension.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + +package org.eclipse.tractusx.edc.oauth2; + +import org.eclipse.edc.runtime.metamodel.annotation.Inject; +import org.eclipse.edc.runtime.metamodel.annotation.Setting; +import org.eclipse.edc.spi.agent.ParticipantAgentService; +import org.eclipse.edc.spi.agent.ParticipantAgentServiceExtension; +import org.eclipse.edc.spi.iam.ClaimToken; +import org.eclipse.edc.spi.monitor.Monitor; +import org.eclipse.edc.spi.system.ServiceExtension; +import org.eclipse.edc.spi.system.ServiceExtensionContext; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.regex.Pattern; + +import static org.eclipse.edc.spi.agent.ParticipantAgent.PARTICIPANT_IDENTITY; + +public class CxParticipantExtension implements ServiceExtension, ParticipantAgentServiceExtension { + + public static final String REFERRING_CONNECTOR_CLAIM = "referringConnector"; + + private static final String DEFAULT_PARTICIPANT_ID_REGEX = "[^/]+(?=/$|$)"; + private static final int DEFAULT_PARTICIPANT_ID_REGEX_GROUP = 0; + + @Setting(value = "Participant Extractor from referringConnector regex", defaultValue = CxParticipantExtension.DEFAULT_PARTICIPANT_ID_REGEX) + private static final String PARTICIPANT_ID_REGEX = "tx.participant.id.regex"; + + @Setting(value = "Participant Extractor from referringConnector regex group", defaultValue = "0") + private static final String PARTICIPANT_ID_REGEX_GROUP = "tx.participant.id.regexGroup"; + @Inject + private ParticipantAgentService agentService; + + private Pattern participantRegex; + + private int participantRegexGroup; + + @Inject + private Monitor monitor; + + @Override + public void initialize(ServiceExtensionContext context) { + this.participantRegex = Pattern.compile(context.getConfig().getString(PARTICIPANT_ID_REGEX, DEFAULT_PARTICIPANT_ID_REGEX)); + this.participantRegexGroup = context.getConfig().getInteger(PARTICIPANT_ID_REGEX_GROUP, DEFAULT_PARTICIPANT_ID_REGEX_GROUP); + + agentService.register(this); + } + + @Override + public @NotNull Map attributesFor(ClaimToken token) { + var referringConnector = token.getClaim(REFERRING_CONNECTOR_CLAIM); + if (referringConnector instanceof String referringConnectorUrl) { + var matcher = participantRegex.matcher(referringConnectorUrl); + if (matcher.find()) { + var id = matcher.group(participantRegexGroup); + return Map.of(PARTICIPANT_IDENTITY, id); + } + monitor.warning("Unable to extract the participant id from the referring connector claim"); + } + return Map.of(); + } +} diff --git a/edc-extensions/cx-oauth2/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension b/edc-extensions/cx-oauth2/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension index 964ae5b59..d3d98beb2 100644 --- a/edc-extensions/cx-oauth2/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +++ b/edc-extensions/cx-oauth2/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension @@ -19,3 +19,4 @@ # org.eclipse.tractusx.edc.oauth2.CxOauth2Extension +org.eclipse.tractusx.edc.oauth2.CxParticipantExtension diff --git a/edc-extensions/cx-oauth2/src/test/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtensionTest.java b/edc-extensions/cx-oauth2/src/test/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtensionTest.java new file mode 100644 index 000000000..aabbe35e1 --- /dev/null +++ b/edc-extensions/cx-oauth2/src/test/java/org/eclipse/tractusx/edc/oauth2/CxParticipantExtensionTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + +package org.eclipse.tractusx.edc.oauth2; + +import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; +import org.eclipse.edc.spi.agent.ParticipantAgentService; +import org.eclipse.edc.spi.iam.ClaimToken; +import org.eclipse.edc.spi.system.ServiceExtensionContext; +import org.eclipse.edc.spi.system.injection.ObjectFactory; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; +import org.junit.jupiter.params.provider.ArgumentsSource; + +import java.util.Map; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.eclipse.edc.spi.agent.ParticipantAgent.PARTICIPANT_IDENTITY; +import static org.eclipse.tractusx.edc.oauth2.CxParticipantExtension.REFERRING_CONNECTOR_CLAIM; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + +@ExtendWith(DependencyInjectionExtension.class) +public class CxParticipantExtensionTest { + + CxParticipantExtension extension; + + ParticipantAgentService agentService = mock(ParticipantAgentService.class); + + ServiceExtensionContext context; + + @BeforeEach + void setUp(ObjectFactory factory, ServiceExtensionContext context) { + this.context = spy(context); + context.registerService(ParticipantAgentService.class, agentService); + extension = factory.constructInstance(CxParticipantExtension.class); + } + + @Test + void initialize() { + extension.initialize(context); + verify(agentService).register(isA(CxParticipantExtension.class)); + } + + + @ParameterizedTest + @ArgumentsSource(ClaimProvider.class) + void attributesFor_shouldMatchTheId(Map claims) { + var attributes = Map.of(PARTICIPANT_IDENTITY, "BPNSOKRATES"); + extension.initialize(context); + var claimToken = ClaimToken.Builder.newInstance().claims(claims).build(); + assertThat(extension.attributesFor(claimToken)).containsExactlyEntriesOf(attributes); + } + + static class ClaimProvider implements ArgumentsProvider { + ClaimProvider() { + } + + @Override + public Stream provideArguments(ExtensionContext context) { + return Stream.of( + Map.of(REFERRING_CONNECTOR_CLAIM, "http://sokrates-controlplane/BPNSOKRATES"), + Map.of(REFERRING_CONNECTOR_CLAIM, "http://sokrates-controlplane/BPNSOKRATES/"), + Map.of(REFERRING_CONNECTOR_CLAIM, "http://sokrates-controlplane/test/path/BPNSOKRATES"), + Map.of(REFERRING_CONNECTOR_CLAIM, "https://sokrates-controlplane/test/path/BPNSOKRATES"), + Map.of(REFERRING_CONNECTOR_CLAIM, "BPNSOKRATES") + ).map(Arguments::arguments); + } + } +} + diff --git a/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpVaultExtension.java b/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpVaultExtension.java index 1126517b5..237171daa 100644 --- a/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpVaultExtension.java +++ b/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/AbstractHashicorpVaultExtension.java @@ -20,6 +20,7 @@ package org.eclipse.tractusx.edc.hashicorpvault; +import com.fasterxml.jackson.databind.ObjectMapper; import okhttp3.OkHttpClient; import org.eclipse.edc.spi.system.ServiceExtensionContext; @@ -50,6 +51,14 @@ public class AbstractHashicorpVaultExtension { private static final String VAULT_TIMEOUT_SECONDS = "edc.vault.hashicorp.timeout.seconds"; + protected HashicorpVaultClient createVaultClient(ServiceExtensionContext context, ObjectMapper mapper) { + var config = loadHashicorpVaultClientConfig(context); + + var okHttpClient = createOkHttpClient(config); + + return new HashicorpVaultClient(config, okHttpClient, mapper); + } + protected OkHttpClient createOkHttpClient(HashicorpVaultClientConfig config) { OkHttpClient.Builder builder = new OkHttpClient.Builder() diff --git a/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthExtension.java b/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthExtension.java index f8b42242f..8bbf4634f 100644 --- a/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthExtension.java +++ b/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthExtension.java @@ -20,11 +20,12 @@ package org.eclipse.tractusx.edc.hashicorpvault; -import okhttp3.OkHttpClient; +import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.runtime.metamodel.annotation.Requires; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.health.HealthCheckService; +import org.eclipse.edc.spi.types.TypeManager; @Requires(HealthCheckService.class) public class HashicorpVaultHealthExtension extends AbstractHashicorpVaultExtension @@ -34,19 +35,21 @@ public class HashicorpVaultHealthExtension extends AbstractHashicorpVaultExtensi public static final boolean VAULT_HEALTH_CHECK_DEFAULT = true; + @Inject + private HealthCheckService healthCheckService; + + @Inject + private TypeManager typeManager; + @Override public String name() { return "Hashicorp Vault Health Check"; } + @Override public void initialize(ServiceExtensionContext context) { - final HashicorpVaultClientConfig config = loadHashicorpVaultClientConfig(context); - - final OkHttpClient okHttpClient = createOkHttpClient(config); - - final HashicorpVaultClient client = - new HashicorpVaultClient(config, okHttpClient, context.getTypeManager().getMapper()); + var client = createVaultClient(context, typeManager.getMapper()); configureHealthCheck(client, context); @@ -54,14 +57,13 @@ public void initialize(ServiceExtensionContext context) { } private void configureHealthCheck(HashicorpVaultClient client, ServiceExtensionContext context) { - final boolean healthCheckEnabled = + var healthCheckEnabled = context.getSetting(VAULT_HEALTH_CHECK, VAULT_HEALTH_CHECK_DEFAULT); if (!healthCheckEnabled) return; - final HashicorpVaultHealthCheck healthCheck = + var healthCheck = new HashicorpVaultHealthCheck(client, context.getMonitor()); - final HealthCheckService healthCheckService = context.getService(HealthCheckService.class); healthCheckService.addLivenessProvider(healthCheck); healthCheckService.addReadinessProvider(healthCheck); healthCheckService.addStartupStatusProvider(healthCheck); diff --git a/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultVaultExtension.java b/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultVaultExtension.java index 8ebf4777f..3a979f639 100644 --- a/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultVaultExtension.java +++ b/edc-extensions/hashicorp-vault/src/main/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultVaultExtension.java @@ -20,7 +20,7 @@ package org.eclipse.tractusx.edc.hashicorpvault; -import okhttp3.OkHttpClient; +import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.runtime.metamodel.annotation.Provides; import org.eclipse.edc.spi.security.CertificateResolver; import org.eclipse.edc.spi.security.PrivateKeyResolver; @@ -28,11 +28,15 @@ import org.eclipse.edc.spi.security.VaultPrivateKeyResolver; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; +import org.eclipse.edc.spi.types.TypeManager; @Provides({Vault.class, CertificateResolver.class, PrivateKeyResolver.class}) public class HashicorpVaultVaultExtension extends AbstractHashicorpVaultExtension implements ServiceExtension { + @Inject + private TypeManager typeManager; + @Override public String name() { return "Hashicorp Vault"; @@ -40,16 +44,12 @@ public String name() { @Override public void initialize(ServiceExtensionContext context) { - final HashicorpVaultClientConfig config = loadHashicorpVaultClientConfig(context); - - final OkHttpClient okHttpClient = createOkHttpClient(config); - - final HashicorpVaultClient client = new HashicorpVaultClient(config, okHttpClient, context.getTypeManager().getMapper()); + var client = createVaultClient(context, typeManager.getMapper()); - final HashicorpVault vault = new HashicorpVault(client); - final CertificateResolver certificateResolver = + var vault = new HashicorpVault(client); + var certificateResolver = new HashicorpCertificateResolver(vault, context.getMonitor()); - final VaultPrivateKeyResolver privateKeyResolver = new VaultPrivateKeyResolver(vault); + var privateKeyResolver = new VaultPrivateKeyResolver(vault); context.registerService(Vault.class, vault); context.registerService(CertificateResolver.class, certificateResolver); diff --git a/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultExtensionTest.java b/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultExtensionTest.java index 33d3e2bd7..7e355d48f 100644 --- a/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultExtensionTest.java +++ b/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultExtensionTest.java @@ -20,15 +20,21 @@ package org.eclipse.tractusx.edc.hashicorpvault; +import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; import org.eclipse.edc.spi.monitor.Monitor; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.health.HealthCheckService; -import org.eclipse.edc.spi.types.TypeManager; +import org.eclipse.edc.spi.system.injection.ObjectFactory; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.Mockito; +import org.junit.jupiter.api.extension.ExtendWith; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +@ExtendWith(DependencyInjectionExtension.class) class HashicorpVaultExtensionTest { private static final String VAULT_URL = "https://example.com"; @@ -42,47 +48,24 @@ class HashicorpVaultExtensionTest { private HealthCheckService healthCheckService; @BeforeEach - void setup() { - context = Mockito.mock(ServiceExtensionContext.class); - monitor = Mockito.mock(Monitor.class); - healthCheckService = Mockito.mock(HealthCheckService.class); - extension = new HashicorpVaultVaultExtension(); - - Mockito.when(context.getService(HealthCheckService.class)).thenReturn(healthCheckService); - Mockito.when(context.getMonitor()).thenReturn(monitor); - Mockito.when(context.getTypeManager()).thenReturn(new TypeManager()); - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_URL, null)) - .thenReturn(VAULT_URL); - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_TOKEN, null)) - .thenReturn(VAULT_TOKEN); - - Mockito.when( - context.getSetting( - HashicorpVaultVaultExtension.VAULT_API_SECRET_PATH, - HashicorpVaultVaultExtension.VAULT_API_SECRET_PATH_DEFAULT)) - .thenReturn(HashicorpVaultVaultExtension.VAULT_API_SECRET_PATH_DEFAULT); - Mockito.when( - context.getSetting( - HashicorpVaultVaultExtension.VAULT_API_HEALTH_PATH, - HashicorpVaultVaultExtension.VAULT_API_HEALTH_PATH_DEFAULT)) - .thenReturn(HashicorpVaultVaultExtension.VAULT_API_HEALTH_PATH_DEFAULT); - Mockito.when( - context.getSetting( - HashicorpVaultVaultExtension.VAULT_HEALTH_CHECK_STANDBY_OK, - HashicorpVaultVaultExtension.VAULT_HEALTH_CHECK_STANDBY_OK_DEFAULT)) - .thenReturn(HashicorpVaultVaultExtension.VAULT_HEALTH_CHECK_STANDBY_OK_DEFAULT); + void setUp(ObjectFactory factory, ServiceExtensionContext context) { + this.context = spy(context); + context.registerService(HealthCheckService.class, healthCheckService); + monitor = mock(Monitor.class); + healthCheckService = mock(HealthCheckService.class); + extension = factory.constructInstance(HashicorpVaultVaultExtension.class); } @Test void throwsHashicorpVaultExceptionOnVaultUrlUndefined() { - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_URL, null)).thenReturn(null); + when(context.getSetting(HashicorpVaultVaultExtension.VAULT_URL, null)).thenReturn(null); Assertions.assertThrows(HashicorpVaultException.class, () -> extension.initialize(context)); } @Test void throwsHashicorpVaultExceptionOnVaultTokenUndefined() { - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_TOKEN, null)) + when(context.getSetting(HashicorpVaultVaultExtension.VAULT_TOKEN, null)) .thenReturn(null); Assertions.assertThrows(HashicorpVaultException.class, () -> extension.initialize(context)); diff --git a/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthCheckExtensionTest.java b/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthCheckExtensionTest.java index f5f0f26b0..57a32ae99 100644 --- a/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthCheckExtensionTest.java +++ b/edc-extensions/hashicorp-vault/src/test/java/org/eclipse/tractusx/edc/hashicorpvault/HashicorpVaultHealthCheckExtensionTest.java @@ -20,100 +20,78 @@ package org.eclipse.tractusx.edc.hashicorpvault; -import org.eclipse.edc.spi.monitor.Monitor; +import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.health.HealthCheckService; -import org.eclipse.edc.spi.types.TypeManager; -import org.junit.jupiter.api.Assertions; +import org.eclipse.edc.spi.system.injection.ObjectFactory; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.Mockito; +import org.junit.jupiter.api.extension.ExtendWith; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@ExtendWith(DependencyInjectionExtension.class) class HashicorpVaultHealthCheckExtensionTest { private static final String VAULT_URL = "https://example.com"; private static final String VAULT_TOKEN = "token"; - + private final HealthCheckService healthCheckService = mock(HealthCheckService.class); private HashicorpVaultHealthExtension extension; - - // mocks private ServiceExtensionContext context; - private Monitor monitor; - private HealthCheckService healthCheckService; @BeforeEach - void setup() { - context = Mockito.mock(ServiceExtensionContext.class); - monitor = Mockito.mock(Monitor.class); - healthCheckService = Mockito.mock(HealthCheckService.class); - extension = new HashicorpVaultHealthExtension(); - - Mockito.when(context.getService(HealthCheckService.class)).thenReturn(healthCheckService); - Mockito.when(context.getMonitor()).thenReturn(monitor); - Mockito.when(context.getTypeManager()).thenReturn(new TypeManager()); - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_URL, null)) + void setUp(ObjectFactory factory, ServiceExtensionContext context) { + context.registerService(HealthCheckService.class, healthCheckService); + this.context = spy(context); + extension = factory.constructInstance(HashicorpVaultHealthExtension.class); + when(this.context.getSetting(HashicorpVaultVaultExtension.VAULT_URL, null)) .thenReturn(VAULT_URL); - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_TOKEN, null)) + when(this.context.getSetting(HashicorpVaultVaultExtension.VAULT_TOKEN, null)) .thenReturn(VAULT_TOKEN); - - Mockito.when( - context.getSetting( - HashicorpVaultHealthExtension.VAULT_API_SECRET_PATH, - HashicorpVaultHealthExtension.VAULT_API_SECRET_PATH_DEFAULT)) - .thenReturn(HashicorpVaultHealthExtension.VAULT_API_SECRET_PATH_DEFAULT); - Mockito.when( - context.getSetting( - HashicorpVaultHealthExtension.VAULT_API_HEALTH_PATH, - HashicorpVaultHealthExtension.VAULT_API_HEALTH_PATH_DEFAULT)) - .thenReturn(HashicorpVaultHealthExtension.VAULT_API_HEALTH_PATH_DEFAULT); - Mockito.when( - context.getSetting( - HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK, - HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK_DEFAULT)) - .thenReturn(HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK_DEFAULT); - Mockito.when( - context.getSetting( - HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK_STANDBY_OK, - HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK_STANDBY_OK_DEFAULT)) - .thenReturn(HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK_STANDBY_OK_DEFAULT); } - + @Test void registersHealthCheckIfEnabled() { - Mockito.when(context.getSetting(HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK, true)) + when(context.getSetting(HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK, true)) .thenReturn(true); extension.initialize(context); - Mockito.verify(healthCheckService, Mockito.times(1)).addReadinessProvider(Mockito.any()); - Mockito.verify(healthCheckService, Mockito.times(1)).addLivenessProvider(Mockito.any()); - Mockito.verify(healthCheckService, Mockito.times(1)).addStartupStatusProvider(Mockito.any()); + verify(healthCheckService, times(1)).addReadinessProvider(any()); + verify(healthCheckService, times(1)).addLivenessProvider(any()); + verify(healthCheckService, times(1)).addStartupStatusProvider(any()); } @Test void registersNoHealthCheckIfDisabled() { - Mockito.when(context.getSetting(HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK, true)) + when(context.getSetting(HashicorpVaultHealthExtension.VAULT_HEALTH_CHECK, true)) .thenReturn(false); extension.initialize(context); - Mockito.verify(healthCheckService, Mockito.times(0)).addReadinessProvider(Mockito.any()); - Mockito.verify(healthCheckService, Mockito.times(0)).addLivenessProvider(Mockito.any()); - Mockito.verify(healthCheckService, Mockito.times(0)).addStartupStatusProvider(Mockito.any()); + verify(healthCheckService, times(0)).addReadinessProvider(any()); + verify(healthCheckService, times(0)).addLivenessProvider(any()); + verify(healthCheckService, times(0)).addStartupStatusProvider(any()); } @Test void throwsHashicorpVaultExceptionOnVaultUrlUndefined() { - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_URL, null)).thenReturn(null); + when(context.getSetting(HashicorpVaultVaultExtension.VAULT_URL, null)).thenReturn(null); - Assertions.assertThrows(HashicorpVaultException.class, () -> extension.initialize(context)); + assertThrows(HashicorpVaultException.class, () -> extension.initialize(context)); } @Test void throwsHashicorpVaultExceptionOnVaultTokenUndefined() { - Mockito.when(context.getSetting(HashicorpVaultVaultExtension.VAULT_TOKEN, null)) + when(context.getSetting(HashicorpVaultVaultExtension.VAULT_TOKEN, null)) .thenReturn(null); - Assertions.assertThrows(HashicorpVaultException.class, () -> extension.initialize(context)); + assertThrows(HashicorpVaultException.class, () -> extension.initialize(context)); } } diff --git a/edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/contractdefinition/V0_0_6__Alter_ContractDefinition_Rename_selector_expression.sql b/edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/contractdefinition/V0_0_6__Alter_ContractDefinition_Rename_selector_expression.sql new file mode 100644 index 000000000..3d3cad56b --- /dev/null +++ b/edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/contractdefinition/V0_0_6__Alter_ContractDefinition_Rename_selector_expression.sql @@ -0,0 +1,15 @@ +-- +-- Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +-- +-- This program and the accompanying materials are made available under the +-- terms of the Apache License, Version 2.0 which is available at +-- https://www.apache.org/licenses/LICENSE-2.0 +-- +-- SPDX-License-Identifier: Apache-2.0 +-- +-- Contributors: +-- Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation +-- + +-- add columns +ALTER TABLE edc_contract_definitions RENAME COLUMN selector_expression TO assets_selector; diff --git a/edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/transferprocess/V0_0_10__Alter_TransferProcess_Rename_transfer_process_column.sql b/edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/transferprocess/V0_0_10__Alter_TransferProcess_Rename_transfer_process_column.sql new file mode 100644 index 000000000..80301988a --- /dev/null +++ b/edc-extensions/postgresql-migration/src/main/resources/org/eclipse/tractusx/edc/postgresql/migration/transferprocess/V0_0_10__Alter_TransferProcess_Rename_transfer_process_column.sql @@ -0,0 +1,15 @@ +-- +-- Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +-- +-- This program and the accompanying materials are made available under the +-- terms of the Apache License, Version 2.0 which is available at +-- https://www.apache.org/licenses/LICENSE-2.0 +-- +-- SPDX-License-Identifier: Apache-2.0 +-- +-- Contributors: +-- Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation +-- + +-- add column +ALTER TABLE edc_transfer_process RENAME COLUMN transferprocess_properties TO private_properties; diff --git a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java index a59ecaf7b..723398a3e 100644 --- a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java +++ b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/ProvisionAdditionalHeadersExtensionTest.java @@ -102,7 +102,7 @@ void shouldPutContractIdAsHeaderInDataAddress( .id("id") .protocol("protocol") .assetId("assetId") - .contractId("aContractId") + .contractId("1:assetId:aContractId") .dataDestination(DataAddress.Builder.newInstance().type("HttpProxy").build()) .callbackAddress("callbackAddress") .build(); @@ -112,6 +112,6 @@ void shouldPutContractIdAsHeaderInDataAddress( assertThat(result).matches(ServiceResult::succeeded); await().atMost(Duration.ofSeconds(5)) - .untilAsserted(() -> verify(dataFlowController).initiateFlow(any(), argThat(it -> "aContractId".equals(it.getProperty("header:Edc-Contract-Agreement-Id"))), any())); + .untilAsserted(() -> verify(dataFlowController).initiateFlow(any(), argThat(it -> "1:assetId:aContractId".equals(it.getProperty("header:Edc-Contract-Agreement-Id"))), any())); } } diff --git a/edc-tests/deployment/src/main/resources/helm/tractusx-connector-azure-vault-test.yaml b/edc-tests/deployment/src/main/resources/helm/tractusx-connector-azure-vault-test.yaml index bc247f91e..086336ce8 100644 --- a/edc-tests/deployment/src/main/resources/helm/tractusx-connector-azure-vault-test.yaml +++ b/edc-tests/deployment/src/main/resources/helm/tractusx-connector-azure-vault-test.yaml @@ -38,6 +38,9 @@ fullnameOverride: tx-prod ################################ # EDC ControlPlane + DataPlane # ################################ +participant: + id: "test-participant" + controlplane: service: type: NodePort diff --git a/edc-tests/deployment/src/main/resources/helm/tractusx-connector-test.yaml b/edc-tests/deployment/src/main/resources/helm/tractusx-connector-test.yaml index 05ba6cef2..0c8d45177 100644 --- a/edc-tests/deployment/src/main/resources/helm/tractusx-connector-test.yaml +++ b/edc-tests/deployment/src/main/resources/helm/tractusx-connector-test.yaml @@ -22,6 +22,10 @@ fullnameOverride: tx-prod ################################ # EDC ControlPlane + DataPlane # ################################ + +participant: + id: "test-participant" + controlplane: service: type: NodePort diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/ContractDefinitionHelperFunctions.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/ContractDefinitionHelperFunctions.java index 4377949ce..bdf80342b 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/ContractDefinitionHelperFunctions.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/ContractDefinitionHelperFunctions.java @@ -22,14 +22,14 @@ import static org.eclipse.edc.spi.CoreConstants.EDC_NAMESPACE; public class ContractDefinitionHelperFunctions { - + public static JsonObject createContractDefinition(String assetId, String definitionId, String accessPolicyId, String contractPolicyId) { return Json.createObjectBuilder() .add(ID, definitionId) .add(TYPE, EDC_NAMESPACE + "ContractDefinition") .add(EDC_NAMESPACE + "accessPolicyId", accessPolicyId) .add(EDC_NAMESPACE + "contractPolicyId", contractPolicyId) - .add(EDC_NAMESPACE + "criteria", Json.createArrayBuilder() + .add(EDC_NAMESPACE + "assetsSelector", Json.createArrayBuilder() .add(Json.createObjectBuilder() .add(TYPE, "CriterionDto") .add(EDC_NAMESPACE + "operandLeft", EDC_NAMESPACE + "id") diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/QueryHelperFunctions.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/QueryHelperFunctions.java index df70cbab5..74bce1f90 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/QueryHelperFunctions.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/helpers/QueryHelperFunctions.java @@ -17,13 +17,13 @@ import jakarta.json.Json; import jakarta.json.JsonObject; -import static org.eclipse.edc.api.query.QuerySpecDto.EDC_QUERY_SPEC_LIMIT; -import static org.eclipse.edc.api.query.QuerySpecDto.EDC_QUERY_SPEC_OFFSET; -import static org.eclipse.edc.api.query.QuerySpecDto.EDC_QUERY_SPEC_TYPE; +import static org.eclipse.edc.api.model.QuerySpecDto.EDC_QUERY_SPEC_LIMIT; +import static org.eclipse.edc.api.model.QuerySpecDto.EDC_QUERY_SPEC_OFFSET; +import static org.eclipse.edc.api.model.QuerySpecDto.EDC_QUERY_SPEC_TYPE; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; public class QueryHelperFunctions { - + public static JsonObject createQuery(int limit, int offset) { return Json.createObjectBuilder() .add(TYPE, EDC_QUERY_SPEC_TYPE) diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java index c03afcff9..f66b01bf3 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/PgParticipantRuntime.java @@ -14,8 +14,10 @@ package org.eclipse.tractusx.edc.lifecycle; -import org.eclipse.edc.junit.testfixtures.MockVault; +import org.eclipse.edc.connector.core.vault.InMemoryVault; import org.eclipse.edc.spi.iam.IdentityService; +import org.eclipse.edc.spi.monitor.Monitor; +import org.eclipse.edc.spi.result.Result; import org.eclipse.edc.spi.security.Vault; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; @@ -26,6 +28,8 @@ import java.util.List; import java.util.Map; +import static org.mockito.Mockito.mock; + public class PgParticipantRuntime extends ParticipantRuntime { private final String dbName; @@ -34,7 +38,7 @@ public PgParticipantRuntime(String moduleName, String runtimeName, String bpn, M super(moduleName, runtimeName, bpn, properties); this.dbName = runtimeName.toLowerCase(); this.registerServiceMock(IdentityService.class, new MockDapsService(bpn)); - this.registerServiceMock(Vault.class, new MockVault()); + this.registerServiceMock(Vault.class, new InMemoryVaultOverride(mock(Monitor.class))); } @Override @@ -43,4 +47,18 @@ protected void bootExtensions(ServiceExtensionContext context, List deleteSecret(String s) { + super.deleteSecret(s); + return Result.success(); + } + } + } diff --git a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java index 5309f68b9..ba0a1b20a 100644 --- a/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java +++ b/edc-tests/e2e-tests/src/test/java/org/eclipse/tractusx/edc/lifecycle/TestRuntimeConfiguration.java @@ -51,8 +51,7 @@ public class TestRuntimeConfiguration { static final String SOKRATES_DATAPLANE_CONTROL_PORT = String.valueOf(getFreePort()); static final String SOKRATES_DATAPLANE_PROXY_PORT = String.valueOf(getFreePort()); - - + public static Map sokratesPostgresqlConfiguration() { var baseConfiguration = sokratesConfiguration(); var postgresConfiguration = postgresqlConfiguration(SOKRATES_NAME.toLowerCase()); @@ -130,7 +129,7 @@ public static Map sokratesConfiguration() { } }; } - + public static Map platoConfiguration() { return new HashMap<>() { { diff --git a/gradle.properties b/gradle.properties index 6aa7371c6..27222980b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ group=org.eclipse.tractusx.edc version=0.4.1-SNAPSHOT # configure the build: -annotationProcessorVersion=0.0.1-milestone-9 -edcGradlePluginsVersion=0.0.1-milestone-9 -metaModelVersion=0.0.1-milestone-9 +annotationProcessorVersion=0.1.0-20230529-SNAPSHOT +edcGradlePluginsVersion=0.1.0-20230529-SNAPSHOT +metaModelVersion=0.1.0-20230529-SNAPSHOT txScmConnection=scm:git:git@github.com:eclipse-tractusx/tractusx-edc.git txWebsiteUrl=https://github.com/eclipse-tractusx/tractusx-edc.git txScmUrl=https://github.com/eclipse-tractusx/tractusx-edc.git diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1d8fae9e2..6c76b131a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ format.version = "1.1" [versions] -edc = "0.0.1-milestone-9" +edc = "0.1.0-20230529-SNAPSHOT" postgres = "42.6.0" awaitility = "4.2.0" nimbus = "9.31" diff --git a/resources/openapi/yaml/control-plane-adapter-api.yaml b/resources/openapi/yaml/control-plane-adapter-api.yaml index 1d87965e5..628b81559 100644 --- a/resources/openapi/yaml/control-plane-adapter-api.yaml +++ b/resources/openapi/yaml/control-plane-adapter-api.yaml @@ -23,7 +23,7 @@ paths: type: array example: null items: - $ref: '#/components/schemas/EndpointDataReferenceEntryDto' + $ref: '#/components/schemas/EndpointDataReferenceEntry' "400": content: application/json: @@ -154,6 +154,12 @@ components: type: object example: null properties: + '@context': + type: object + example: null + '@type': + type: string + example: null authCodeId: type: string example: null @@ -211,6 +217,12 @@ components: type: object example: null properties: + '@context': + type: object + example: null + '@type': + type: string + example: null properties: type: object additionalProperties: @@ -243,7 +255,7 @@ components: target: type: string example: null - EndpointDataReferenceEntryDto: + EndpointDataReferenceEntry: type: object example: null properties: @@ -260,13 +272,19 @@ components: type: object example: null properties: + '@context': + type: object + example: null + '@id': + type: string + example: null + '@type': + type: string + example: null createdAt: type: integer format: int64 example: null - id: - type: string - example: null JsonObject: type: object additionalProperties: diff --git a/resources/openapi/yaml/edc-dataplane-proxy-consumer-api.yaml b/resources/openapi/yaml/edc-dataplane-proxy-consumer-api.yaml new file mode 100644 index 000000000..861d83730 --- /dev/null +++ b/resources/openapi/yaml/edc-dataplane-proxy-consumer-api.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.1 +paths: + /aas/request: + post: + operationId: requestAsset + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/AssetRequest' + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/AssetRequest' + description: Requests asset data + tags: + - Data Plane Proxy API +components: + schemas: + AssetRequest: + type: object + example: null + properties: + assetId: + type: string + example: null + endpointUrl: + type: string + example: null + transferProcessId: + type: string + example: null diff --git a/resources/openapi/yaml/edc-dataplane-proxy-provider-api.yaml b/resources/openapi/yaml/edc-dataplane-proxy-provider-api.yaml new file mode 100644 index 000000000..1a55c51b7 --- /dev/null +++ b/resources/openapi/yaml/edc-dataplane-proxy-provider-api.yaml @@ -0,0 +1,12 @@ +openapi: 3.0.1 +paths: + /gateway/{paths}: + get: + operationId: requestAsset + responses: + default: + content: + application/json: {} + description: Gets asset data + tags: + - Data Plane Proxy API