amosproj / amos2024ss02-international-dataspace-station

MIT License
1 stars 1 forks source link

IDS

International Dataspace Station

in collaboration with DATEV

📖 About

With the increase of data exchange among different sectors like finance, legal, healthcare, government and others, ensuring easy interoperability while still following data usage rules, policies, and local regulations is becoming increasingly important. Dataspace is the envisioned solution to tackle these challenges.

Dataspace operates with the help of data connectors, which enable secure and effective communication and exchange of data. They are a tool to connect many data endpoints to increase the pool of available data and to accelerate the data economy. By linking data connectors, dataspaces become protected environments where participants can freely share data. Data sovereignty, transparency and fairness are ensured by adherence to a set of rules.

Our goal is to explore the feasibiltiy of dataspace usage with regards to data sovereignty. This includes testing the maturity of dataspace, importance of the components and ease of deployment.

Learn in more detail about how our software works here: IDS - Software Architecture

⚡️ Requirements

If you want to run the connectors on your local machine, make sure that you have the following packages installed:

Package Version
JDK 17
Gradle 8.7
jq 1.7.1
Docker (optional) 26

🐳 Docker usage

To run the code using docker containers, use the following commands in separate terminals for both provider and consumer connectors:

1. Build a docker image

mkdir docker-images
sudo docker build -t <provider|consumer> . -f <provider|consumer>.Dockerfile
sudo docker save -o ./docker-images/<provider|consumer>.tar <provider|consumer>

2. Load and run

sudo docker load -i ./docker-images/<provider|consumer>.tar
sudo docker run -it -p <19193:19193|29193:29193> <provider|consumer>

Note: If you are using macOS, you might have to modify the config.json file:

  1. Go to ~/.docker/config.json
  2. Change the credsStore value from desktop to osxkeychain.

🖥️ Running the connectors locally

If you don't want to use docker, you can run the connectors locally. Use the following commands in separate terminals:

Provider connector

In the first terminal, use the following command to run a provider:

java -Dedc.keystore=resources/certs/cert.pfx -Dedc.keystore.password=123456 -Dedc.vault=resources/configuration/provider-vault.properties -Dedc.fs.config=resources/configuration/provider-configuration.properties -jar connector/build/libs/connector.jar

Consumer connector

In the second terminal, use the following command to run a consumer:

java -Dedc.keystore=resources/certs/cert.pfx -Dedc.keystore.password=123456 -Dedc.vault=resources/configuration/consumer-vault.properties -Dedc.fs.config=resources/configuration/consumer-configuration.properties -jar connector/build/libs/connector.jar

🔗 Establishing connection for data exchange

In the third (main) terminal, use the following HTTP requests to establish a connection between the provider and the consumer to be able to exchange data:

1. Register data plane

curl -H 'Content-Type: application/json' \
     -d @resources/dataplane/register-data-plane-provider.json \
     -X POST "http://localhost:19193/management/v2/dataplanes" -s | jq

2. Create an asset

curl -d @resources/create-asset.json \
  -H 'content-type: application/json' http://localhost:19193/management/v3/assets \
  -s | jq

3. Create a policy

curl -d @resources/create-policy.json \
  -H 'content-type: application/json' http://localhost:19193/management/v2/policydefinitions \
  -s | jq

4. Create a contract definition

curl -d @resources/create-contract-definition.json \
  -H 'content-type: application/json' http://localhost:19193/management/v2/contractdefinitions \
  -s | jq

5. Fetch catalog

curl -X POST "http://localhost:29193/management/v2/catalog/request" \
    -H 'Content-Type: application/json' \
    -d @resources/fetch-catalog.json -s | jq

6. Negotiate contract

Replace the {{contract-offer-id}} placeholder in negotiate-contract.json with the contract offer id you found in the catalog at the path dcat:dataset.odrl:hasPolicy.@id:

curl -d @resources/negotiate-contract.json \
  -X POST -H 'content-type: application/json' http://localhost:29193/management/v2/contractnegotiations \
  -s | jq

7. Get contract agreement id

Replace {{contract-negotiation-id}} with the id from the consumer terminal:

curl -X GET "http://localhost:29193/management/v2/contractnegotiations/{{contract-negotiation-id}}" \
    --header 'Content-Type: application/json' \
    -s | jq


The connectors have now been configured successfully and are ready to be used.