From b1936dba3377a0467cf8c3d28cd1db3f7848b2a3 Mon Sep 17 00:00:00 2001 From: Matthias Fischer Date: Wed, 24 Jul 2024 18:54:58 +0200 Subject: [PATCH 1/5] fix(insomnia): [#xxx] correct prefix in constraint leftOperand --- local/testing/request-collection/IRS_Request_Collection.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/local/testing/request-collection/IRS_Request_Collection.json b/local/testing/request-collection/IRS_Request_Collection.json index 467b0c0d1..deb1e0120 100644 --- a/local/testing/request-collection/IRS_Request_Collection.json +++ b/local/testing/request-collection/IRS_Request_Collection.json @@ -3171,7 +3171,7 @@ "method": "POST", "body": { "mimeType": "application/json", - "text": "{\n\t\"edc:counterPartyAddress\": \"{{ _.PROVIDER_CONTROLPLANE_1 }}/api/v1/dsp\",\n\t\"edc:counterPartyId\": \"{{ _.PROVIDER_BPN }}\",\n\t\"edc:policy\": {\n\t\t\"@id\": \"YWZhOTZlMjYtY2JhMy00OTEzLWExZGQtMjZmNmUyNWNjZTZj:cmVnaXN0cnktYXNzZXQ=:NmFkOTc5NDgtNjYyOS00OThhLWFmZWUtNzBhYmUzNjQ5NDQ0\",\n\t\t\"@type\": \"odrl:Offer\",\n\t\t\"odrl:permission\": {\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:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"Traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\"odrl:prohibition\": [],\n\t\t\"odrl:obligation\": [],\n\t\t\"odrl:assigner\": {\n\t\t\t\"@id\": \"{{ _.PROVIDER_BPN }}\"\n\t\t},\n\t\t\"odrl:target\": {\n\t\t\t\"@id\": \"registry-asset\"\n\t\t}\n\t},\n\t\"edc:protocol\": \"dataspace-protocol-http\",\n\t\"edc:callbackAddresses\": [],\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\",\n\t\t\"dct\": \"https://purl.org/dc/terms/\",\n\t\t\"tx\": \"https://w3id.org/tractusx/v0.0.1/ns/\",\n\t\t\"edc\": \"https://w3id.org/edc/v0.0.1/ns/\",\n\t\t\"dcat\": \"https://www.w3.org/ns/dcat/\",\n\t\t\"dspace\": \"https://w3id.org/dspace/v0.8/\"\n\t}\n}" + "text": "{\n\t\"edc:counterPartyAddress\": \"{{ _.PROVIDER_CONTROLPLANE_1 }}/api/v1/dsp\",\n\t\"edc:counterPartyId\": \"{{ _.PROVIDER_BPN }}\",\n\t\"edc:policy\": {\n\t\t\"@id\": \"YWZhOTZlMjYtY2JhMy00OTEzLWExZGQtMjZmNmUyNWNjZTZj:cmVnaXN0cnktYXNzZXQ=:NmFkOTc5NDgtNjYyOS00OThhLWFmZWUtNzBhYmUzNjQ5NDQ0\",\n\t\t\"@type\": \"odrl:Offer\",\n\t\t\"odrl:permission\": {\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:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"Traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\"odrl:prohibition\": [],\n\t\t\"odrl:obligation\": [],\n\t\t\"odrl:assigner\": {\n\t\t\t\"@id\": \"{{ _.PROVIDER_BPN }}\"\n\t\t},\n\t\t\"odrl:target\": {\n\t\t\t\"@id\": \"registry-asset\"\n\t\t}\n\t},\n\t\"edc:protocol\": \"dataspace-protocol-http\",\n\t\"edc:callbackAddresses\": [],\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\",\n\t\t\"dct\": \"https://purl.org/dc/terms/\",\n\t\t\"tx\": \"https://w3id.org/tractusx/v0.0.1/ns/\",\n\t\t\"edc\": \"https://w3id.org/edc/v0.0.1/ns/\",\n\t\t\"dcat\": \"https://www.w3.org/ns/dcat/\",\n\t\t\"dspace\": \"https://w3id.org/dspace/v0.8/\"\n\t}\n}" }, "preRequestScript": "", "parameters": [], @@ -3830,7 +3830,7 @@ "method": "POST", "body": { "mimeType": "application/json", - "text": "{\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n\t},\n\t\"@id\": \"test123\",\n\t\"policy\": {\n\t\t\"@type\": \"odrl:Set\",\n\t\t\"odrl:permission\": [\n\t\t\t{\n\t\t\t\t\"odrl:action\": \"use\",\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"@type\": \"AtomicConstraint\",\n\t\t\t\t\t\"odrl:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}\n}" + "text": "{\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n\t},\n\t\"@id\": \"test123\",\n\t\"policy\": {\n\t\t\"@type\": \"odrl:Set\",\n\t\t\"odrl:permission\": [\n\t\t\t{\n\t\t\t\t\"odrl:action\": \"use\",\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"@type\": \"AtomicConstraint\",\n\t\t\t\t\t\"odrl:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}\n}" }, "preRequestScript": "", "parameters": [], From da0514b029d2524b959bc2c6de935646d83a0aec Mon Sep 17 00:00:00 2001 From: Matthias Fischer Date: Wed, 24 Jul 2024 18:56:49 +0200 Subject: [PATCH 2/5] fix(impl): [#xxx] EdcRegistration.registerPolicy: correct prefix in constraint leftOperand --- .../irs/ess/service/EdcRegistration.java | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java index aa404f485..55ed45974 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java @@ -144,42 +144,42 @@ private void registerAsset(final String assetId, final String notificationType, private void registerPolicy(final String policyId) { final var body = """ - { - "@context": { - "@vocab": "https://w3id.org/edc/v0.0.1/ns/", - "cx-policy": "https://w3id.org/catenax/policy/", - "odrl": "http://www.w3.org/ns/odrl/2/" - }, - "@id": "%s", - "policy": { - "@type": "odrl:Set", - "odrl:permission": [ - { - "odrl:action": "use", - "odrl:constraint": { - "@type": "AtomicConstraint", - "odrl:and": [ - { - "odrl:leftOperand": "cx-policy:FrameworkAgreement", - "odrl:operator": { - "@id": "odrl:eq" - }, - "odrl:rightOperand": "traceability:1.0" - }, - { - "odrl:leftOperand": "cx-policy:UsagePurpose", - "odrl:operator": { - "@id": "odrl:eq" - }, - "odrl:rightOperand": "cx.core.industrycore:1" + { + "@context": { + "@vocab": "https://w3id.org/edc/v0.0.1/ns/", + "cx-policy": "https://w3id.org/catenax/policy/", + "odrl": "http://www.w3.org/ns/odrl/2/" + }, + "@id": "%s", + "policy": { + "@type": "odrl:Set", + "odrl:permission": [ + { + "odrl:action": "use", + "odrl:constraint": { + "@type": "AtomicConstraint", + "odrl:and": [ + { + "odrl:leftOperand": "https://w3id.org/catenax/policy/FrameworkAgreement", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "traceability:1.0" + }, + { + "odrl:leftOperand": "https://w3id.org/catenax/policy/UsagePurpose", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "cx.core.industrycore:1" + } + ] } - ] - } + } + ] } - ] - } - } - """.formatted(policyId); + } + """.formatted(policyId); final var entity = restTemplate.exchange(edcProviderUrl + policydefinitionsPath, HttpMethod.POST, toEntity(body), String.class); From cea92638b9f4eca3b12e8bf4f5b6dbcd17118523 Mon Sep 17 00:00:00 2001 From: Matthias Fischer Date: Wed, 24 Jul 2024 19:13:42 +0200 Subject: [PATCH 3/5] chore(changelog): [#xxx] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 608febac4..a29e08596 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha - Fixed already merged implementation from _"Access and Usage Policy Validation flow correction. #757"_ where fallback to default policy was not implemented correctly. - Improved exception handling concerning invalid date format in search parameters for `GET /irs/policies/paged`. #639 +- Fix policy leftOperand prefix in IRS_Request_Collection.json and EdcRegistration.registerPolicy + (`https://w3id.org/catenax/policy` instead of `cx-policy`). ### Changed From 6772c0cdfd5da9c460e54926cb6c924ea4da5f88 Mon Sep 17 00:00:00 2001 From: Matthias Fischer Date: Thu, 25 Jul 2024 10:20:16 +0200 Subject: [PATCH 4/5] chore(changelog): [#xxx] update changelog --- CHANGELOG.md | 4 ++-- charts/item-relationship-service/CHANGELOG.md | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a29e08596..08ec5ab23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha - Fixed already merged implementation from _"Access and Usage Policy Validation flow correction. #757"_ where fallback to default policy was not implemented correctly. - Improved exception handling concerning invalid date format in search parameters for `GET /irs/policies/paged`. #639 -- Fix policy leftOperand prefix in IRS_Request_Collection.json and EdcRegistration.registerPolicy - (`https://w3id.org/catenax/policy` instead of `cx-policy`). +- Change default policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:` + in some remaining code places (in context of #794). ### Changed diff --git a/charts/item-relationship-service/CHANGELOG.md b/charts/item-relationship-service/CHANGELOG.md index 65d41bcb7..7aa7de953 100644 --- a/charts/item-relationship-service/CHANGELOG.md +++ b/charts/item-relationship-service/CHANGELOG.md @@ -62,7 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Change default policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:` +- Change default policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:` + (in context of #794). ## [7.3.0] - 2024-07-15 From 958014bab460da21f3f223d08570754c8ad79088 Mon Sep 17 00:00:00 2001 From: Matthias Fischer Date: Thu, 25 Jul 2024 10:40:41 +0200 Subject: [PATCH 5/5] chore(changelog): [#xxx] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08ec5ab23..09221b645 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha - Fixed already merged implementation from _"Access and Usage Policy Validation flow correction. #757"_ where fallback to default policy was not implemented correctly. - Improved exception handling concerning invalid date format in search parameters for `GET /irs/policies/paged`. #639 -- Change default policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:` +- Change policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:` in some remaining code places (in context of #794). ### Changed