Skip to content

Commit 01b116e

Browse files
Merge branch 'main' into feature/improve-tutorial-resources
2 parents d1e1c20 + e2f4833 commit 01b116e

15 files changed

+3635
-4130
lines changed

DEPENDENCIES

+278-316
Large diffs are not rendered by default.

edc-policy-playground/package-lock.json

+2,798-3,664
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

edc-policy-playground/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"@angular/animations": "^17.0.8",
16-
"@angular/common": "^17.0.8",
17-
"@angular/core": "^17.0.8",
18-
"@angular/forms": "^17.0.8",
19-
"@angular/platform-browser": "^17.0.8",
20-
"@angular/platform-browser-dynamic": "^17.0.8",
21-
"@angular/router": "^17.0.8",
22-
"@angular/compiler": "^17.0.8",
15+
"@angular/animations": "^17.2.3",
16+
"@angular/common": "^17.2.3",
17+
"@angular/core": "^17.2.3",
18+
"@angular/forms": "^17.2.2",
19+
"@angular/platform-browser": "^17.2.3",
20+
"@angular/platform-browser-dynamic": "^17.2.3",
21+
"@angular/router": "^17.2.3",
22+
"@angular/compiler": "^17.2.3",
2323
"@angular/material": "^17.0.4",
2424
"@codemirror/lang-json": "^6.0.1",
2525
"@codemirror/state": "^6.4.0",
@@ -29,14 +29,14 @@
2929
"zone.js": "~0.14.0"
3030
},
3131
"devDependencies": {
32-
"@angular-devkit/build-angular": "^17.0.8",
32+
"@angular-devkit/build-angular": "^17.2.0",
3333
"@angular-eslint/builder": "17.2.1",
34-
"@angular-eslint/eslint-plugin": "17.1.1",
34+
"@angular-eslint/eslint-plugin": "17.2.1",
3535
"@angular-eslint/eslint-plugin-template": "17.2.1",
3636
"@angular-eslint/schematics": "17.1.0",
3737
"@angular-eslint/template-parser": "17.1.1",
38-
"@angular/cli": "~17.0.8",
39-
"@angular/compiler-cli": "^17.0.8",
38+
"@angular/cli": "~17.2.0",
39+
"@angular/compiler-cli": "^17.2.3",
4040
"@types/jasmine": "~5.1.4",
4141
"@types/node": "^20.10.7",
4242
"@typescript-eslint/eslint-plugin": "6.18.1",
@@ -49,6 +49,6 @@
4949
"karma-coverage": "~2.2.0",
5050
"karma-jasmine": "~5.1.0",
5151
"karma-jasmine-html-reporter": "~2.1.0",
52-
"typescript": "~5.2.2"
52+
"typescript": "~5.3.3"
5353
}
5454
}

mxd/README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ Alternatively, please check out the [Postman collections here](./postman)
217217
## 3. Tutorials
218218

219219
- [Restrict Asset Using Access Policies](./docs/Access%20Policies%20Tutorial.md)
220-
221220
- [File Transfer: Azure Blob Storage to Azure Blob Storage](./docs/File%20Transfer%20Azure%20to%20Azure.md)
222221
- [File Transfer: Azure Blob Storage to Amazon S3](./docs/File%20Transfer%20Azure%20to%20S3.md)
223222
- [File Transfer: Amazon S3 to Amazon S3](./docs/File%20Transfer%20S3%20to%20S3.md)
@@ -1311,8 +1310,12 @@ Can you create another access policy and contract definition which allows Bob to
13111310
`Hint:` Create an access policy using Bob's BPN Number (`BPNL000000000002`) and use this access policy id while creating contract definition.
13121311

13131312
## 8. Improving the setup
1314-
1315-
Improvements can be made to these aspects:
1316-
1317-
- separate out databases: deploy one Postgres per connector, plus one Postgres each for MIW and KC
1318-
- add ingresses for all the various connector endpoints, MIW and Keycloak
1313+
=======
1314+
* [Restrict Asset Using Access Policies](./docs/Access%20Policies%20Tutorial.md)
1315+
* [Business Partner Group Policy](docs/Business%20Partner%20Group%20Policy%20Tutorial.md)
1316+
* [File Transfer: Azure Blob Storage to Azure Blob Storage](./docs/File%20Transfer%20Azure%20to%20Azure.md)
1317+
* [File Transfer: Azure Blob Storage to Amazon S3](./docs/File%20Transfer%20Azure%20to%20S3.md)
1318+
* [File Transfer: Amazon S3 to Amazon S3](./docs/File%20Transfer%20S3%20to%20S3.md)
1319+
* [File Transfer: Amazon S3 to Azure Blob Storage](./docs/File%20Transfer%20S3%20to%20Azure.md)
1320+
* [Simplify negotiation and transfer using the EDR API](./docs/EDR%20Transfer%20Tutorial.md)
1321+
* [Add a new Participant](./docs/Trudy%20Connector%20Tutorial.md)

mxd/docs/Access Policies Tutorial.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ curl --location 'http://localhost/bob/management/v2/policydefinitions' \
3737
"@type": "PolicyDefinitionRequestDto",
3838
"@id": "41",
3939
"policy": {
40-
"@type": "Policy",
40+
"@type": "odrl:Set",
4141
"odrl:permission": [
4242
{
4343
"odrl:action": "USE",
@@ -75,7 +75,7 @@ curl --location 'http://localhost/bob/management/v2/policydefinitions' \
7575
"@type": "PolicyDefinitionRequestDto",
7676
"@id": "42",
7777
"policy": {
78-
"@type": "Policy",
78+
"@type": "odrl:Set",
7979
"odrl:permission": [
8080
{
8181
"odrl:action": "USE",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
# Business Partner Group Policy
2+
3+
## 1. Description
4+
This tutorial demonstrates the process of creating a business partner group and creating a policy that grants access to assets for this business partner group.
5+
For this tutorial, we assume `Alice` as a provider participant and `Bob` as consumer participant.
6+
7+
## 2. Create Business Partner Group
8+
`Alice` adds his partner `Bob` (with BPN: `BPNL000000000002`) to a business partner group named `gold-partners`.
9+
> Note: If you are running MXD, you can skip this step as it has already been done.
10+
```shell
11+
curl --location 'http://localhost/alice/management/business-partner-groups' \
12+
--header 'Content-Type: application/json' \
13+
--header 'X-Api-Key: password' \
14+
--data-raw '{
15+
"@context": {
16+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/"
17+
},
18+
"@id": "BPNL000000000002",
19+
"tx:groups": [
20+
"gold-partners"
21+
]
22+
}'
23+
```
24+
`Alice` can also update business partner group for `Bob`.
25+
```shell
26+
curl --location --request PUT 'http://localhost/alice/management/business-partner-groups' \
27+
--header 'Content-Type: application/json' \
28+
--header 'X-Api-Key: password' \
29+
--data-raw '{
30+
"@context": {
31+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/"
32+
},
33+
"@id": "BPNL000000000002",
34+
"tx:groups": [
35+
"gold-partners",
36+
"platinum-partners"
37+
]
38+
}'
39+
```
40+
41+
`Alice` can check which business partner groups, `Bob` is currently associated.
42+
```shell
43+
curl --location 'http://localhost/alice/management/business-partner-groups/BPNL000000000002' \
44+
--header 'X-Api-Key: password'
45+
```
46+
It should return a response similar to this.
47+
```json
48+
{
49+
"@id": "BPNL000000000002",
50+
"tx:groups": [
51+
"gold-partners",
52+
"platinum-partners"
53+
],
54+
"@context": {
55+
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
56+
"edc": "https://w3id.org/edc/v0.0.1/ns/",
57+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
58+
"odrl": "http://www.w3.org/ns/odrl/2/"
59+
}
60+
}
61+
```
62+
63+
## 3. Create An Asset
64+
```shell
65+
curl --location 'http://localhost/alice/management/v3/assets' \
66+
--header 'Content-Type: application/json' \
67+
--header 'X-Api-Key: password' \
68+
--data-raw '{
69+
"@context": {
70+
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
71+
"edc": "https://w3id.org/edc/v0.0.1/ns/",
72+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
73+
"odrl": "http://www.w3.org/ns/odrl/2/"
74+
},
75+
"@id": "30",
76+
"properties": {
77+
"description": "Product EDC Demo Asset"
78+
},
79+
"dataAddress": {
80+
"@type": "DataAddress",
81+
"type": "HttpData",
82+
"baseUrl": "https://jsonplaceholder.typicode.com/todos/30"
83+
}
84+
}'
85+
```
86+
87+
## 4. Create Policy
88+
89+
### 4.1 Create Access Policy
90+
```shell
91+
curl --location 'http://localhost/alice/management/v2/policydefinitions' \
92+
--header 'Content-Type: application/json' \
93+
--header 'X-Api-Key: password' \
94+
--data-raw '{
95+
"@context": {
96+
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
97+
"edc": "https://w3id.org/edc/v0.0.1/ns/",
98+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
99+
"odrl": "http://www.w3.org/ns/odrl/2/"
100+
},
101+
"@type": "PolicyDefinitionRequestDto",
102+
"@id": "301",
103+
"policy": {
104+
"@type": "odrl:Set",
105+
"odrl:permission": [
106+
{
107+
"odrl:action": "use",
108+
"odrl:constraint": {
109+
"@type": "LogicalConstraint",
110+
"odrl:or": [
111+
{
112+
"@type": "Constraint",
113+
"odrl:leftOperand": "BpnCredential",
114+
"odrl:operator": {
115+
"@id": "odrl:eq"
116+
},
117+
"odrl:rightOperand": "active"
118+
}
119+
]
120+
}
121+
}
122+
]
123+
}
124+
}'
125+
```
126+
### 4.2 Create Business Partner Group Policy
127+
`Alice` creates a policy for `gold-partners` business partner group. This policy applies to all business partner in that group.
128+
```shell
129+
curl --location 'http://localhost/alice/management/v2/policydefinitions' \
130+
--header 'Content-Type: application/json' \
131+
--header 'X-Api-Key: password' \
132+
--data-raw '{
133+
"@context": {
134+
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
135+
"edc": "https://w3id.org/edc/v0.0.1/ns/",
136+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
137+
"odrl": "http://www.w3.org/ns/odrl/2/"
138+
},
139+
"@type": "PolicyDefinitionRequestDto",
140+
"@id": "302",
141+
"policy": {
142+
"@type": "odrl:Set",
143+
"odrl:permission": [
144+
{
145+
"odrl:action": "use",
146+
"odrl:constraint": {
147+
"@type": "LogicalConstraint",
148+
"odrl:or": [
149+
{
150+
"@type": "Constraint",
151+
"odrl:leftOperand": "https://w3id.org/tractusx/v0.0.1/ns/BusinessPartnerGroup",
152+
"odrl:operator": {
153+
"@id": "odrl:eq"
154+
},
155+
"odrl:rightOperand": "gold-partners"
156+
}
157+
]
158+
}
159+
}
160+
]
161+
}
162+
}'
163+
```
164+
165+
## 5. Create Contract Definition
166+
```shell
167+
curl --location 'http://localhost/alice/management/v2/contractdefinitions' \
168+
--header 'Content-Type: application/json' \
169+
--header 'X-Api-Key: password' \
170+
--data-raw '{
171+
"@context": {
172+
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
173+
"edc": "https://w3id.org/edc/v0.0.1/ns/",
174+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
175+
"odrl": "http://www.w3.org/ns/odrl/2/"
176+
},
177+
"@id": "30",
178+
"@type": "ContractDefinition",
179+
"accessPolicyId": "301",
180+
"contractPolicyId": "302",
181+
"assetsSelector": {
182+
"@type": "CriterionDto",
183+
"operandLeft": "https://w3id.org/edc/v0.0.1/ns/id",
184+
"operator": "=",
185+
"operandRight": "30"
186+
}
187+
}'
188+
```
189+
190+
## 6. Query Catalog
191+
Now let's verify whether Bob is able to access the assets or not via querying Alice's catalog.
192+
```shell
193+
curl --location 'http://localhost/bob/management/v2/catalog/request' \
194+
--header 'Content-Type: application/json' \
195+
--header 'X-Api-Key: password' \
196+
--data-raw '{
197+
"@context": {
198+
"@vocab": "https://w3id.org/edc/v0.0.1/ns/",
199+
"edc": "https://w3id.org/edc/v0.0.1/ns/",
200+
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
201+
"odrl": "http://www.w3.org/ns/odrl/2/"
202+
},
203+
"@type": "CatalogRequest",
204+
"counterPartyAddress": "http://alice-controlplane:8084/api/v1/dsp",
205+
"protocol": "dataspace-protocol-http",
206+
"querySpec": {
207+
"offset": 0,
208+
"limit": 50
209+
}
210+
}'
211+
```
212+
213+
You should be able to find this asset (`id: 30`) in the list of catalog returned by `Alice`.
214+
```json
215+
{
216+
"@id": "f6dcc216-9948-4807-8e56-6f867f9226f2",
217+
"@type": "dcat:Catalog",
218+
"dcat:dataset": [
219+
{
220+
"@id": "30",
221+
"@type": "dcat:Dataset",
222+
"odrl:hasPolicy": {
223+
"@id": "MzA=:MzA=:OWNhYzMwM2QtOTYyNi00NzY3LTgxZTUtYWVkNDM4NzAwYmNj",
224+
"@type": "odrl:Set",
225+
"odrl:permission": {
226+
"odrl:target": "30",
227+
"odrl:action": {
228+
"odrl:type": "USE"
229+
},
230+
"odrl:constraint": {
231+
"odrl:or": {
232+
"odrl:leftOperand": "https://w3id.org/tractusx/v0.0.1/ns/BusinessPartnerGroup",
233+
"odrl:operator": {
234+
"@id": "odrl:eq"
235+
},
236+
"odrl:rightOperand": "gold-partners"
237+
}
238+
}
239+
},
240+
"odrl:prohibition": [],
241+
"odrl:obligation": [],
242+
"odrl:target": {
243+
"@id": "30"
244+
}
245+
},
246+
"dcat:distribution": [
247+
{
248+
"@type": "dcat:Distribution",
249+
"dct:format": {
250+
"@id": "HttpProxy-PUSH"
251+
},
252+
"dcat:accessService": "b7c41185-0c2f-42cd-b19d-2ef8e2b6b6a6"
253+
},
254+
{
255+
"@type": "dcat:Distribution",
256+
"dct:format": {
257+
"@id": "HttpData-PULL"
258+
},
259+
"dcat:accessService": "b7c41185-0c2f-42cd-b19d-2ef8e2b6b6a6"
260+
}
261+
],
262+
"description": "Product EDC Demo Asset",
263+
"id": "30"
264+
}
265+
],
266+
"dcat:service": {
267+
"@id": "b7c41185-0c2f-42cd-b19d-2ef8e2b6b6a6",
268+
"@type": "dcat:DataService",
269+
"dct:terms": "connector",
270+
"dct:endpointUrl": "http://alice-controlplane:8084/api/v1/dsp"
271+
},
272+
"participantId": "BPNL000000000001",
273+
"@context": {}
274+
}
275+
```
276+
277+
## 7. References
278+
- [Business Partner Validation Extension](https://github.com/eclipse-tractusx/tractusx-edc/tree/main/edc-extensions/bpn-validation)
279+
- [Business Partner Group API Swagger Documentation](https://app.swaggerhub.com/apis/eclipse-tractusx-bot/tractusx-edc)
280+
- [EDC Management API Swagger Documentation](https://app.swaggerhub.com/apis/eclipse-edc-bot/management-api)

mxd/docs/EDR Transfer Tutorial.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ curl --location 'http://localhost/bob/management/edrs' \
3333
"policy": {
3434
"@type": "odrl:Set",
3535
"odrl:permission": {
36-
"odrl:target": "1",
36+
"odrl:target": "1",
3737
"odrl:action": {
3838
"odrl:type": "USE"
3939
},

0 commit comments

Comments
 (0)