diff --git a/.github/release.yaml b/.github/release.yaml index 667620bab..eb00d35a5 100644 --- a/.github/release.yaml +++ b/.github/release.yaml @@ -21,15 +21,23 @@ --- changelog: exclude: + labels: + - dependencies authors: - - dependabot[bot] + - 'dependabot[bot]' categories: + - title: Breaking changes + labels: + - breaking-change - title: Bugfixes labels: - bug - title: New Features & Improvements labels: - - "*" + - enhancement - title: Documentation labels: - documentation + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 258c67bcf..b4dd1bf4a 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -125,14 +125,14 @@ jobs: - name: Run E2E tests (${{ matrix.variant.dir }}) run: | - ./gradlew compileJava compileTestJava - ./gradlew -p ${{ matrix.variant.dir }} test -DincludeTags="EndToEndTest" + ./gradlew compileJava compileTestJava --refresh-dependencies + ./gradlew -p ${{ matrix.variant.dir }} test -DincludeTags="EndToEndTest" postgres-tests: runs-on: ubuntu-latest services: postgres: - image: postgres:14.2 + image: postgres:16.1 ports: - 5432:5432 env: @@ -143,7 +143,7 @@ jobs: - uses: ./.github/actions/setup-java - name: Run Postgresql E2E tests - run: ./gradlew test -DincludeTags="PostgresqlIntegrationTest" + run: ./gradlew test -DincludeTags="PostgresqlIntegrationTest" --refresh-dependencies dataplane-tests: runs-on: ubuntu-latest diff --git a/DEPENDENCIES b/DEPENDENCIES index 5f23c4b7d..9658b3434 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -144,9 +144,9 @@ maven/mavencentral/dev.failsafe/failsafe/3.3.2, Apache-2.0, approved, #9268 maven/mavencentral/info.picocli/picocli/4.7.5, Apache-2.0, approved, #4365 maven/mavencentral/io.github.classgraph/classgraph/4.8.154, MIT, approved, CQ22530 maven/mavencentral/io.github.classgraph/classgraph/4.8.165, MIT, approved, CQ22530 -maven/mavencentral/io.micrometer/micrometer-commons/1.12.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679 -maven/mavencentral/io.micrometer/micrometer-core/1.12.4, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11678 -maven/mavencentral/io.micrometer/micrometer-observation/1.12.4, Apache-2.0, approved, #11680 +maven/mavencentral/io.micrometer/micrometer-commons/1.12.5, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11679 +maven/mavencentral/io.micrometer/micrometer-core/1.12.5, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #11678 +maven/mavencentral/io.micrometer/micrometer-observation/1.12.5, Apache-2.0, approved, #11680 maven/mavencentral/io.netty/netty-buffer/4.1.100.Final, Apache-2.0, approved, CQ21842 maven/mavencentral/io.netty/netty-buffer/4.1.101.Final, Apache-2.0, approved, CQ21842 maven/mavencentral/io.netty/netty-buffer/4.1.108.Final, Apache-2.0, approved, CQ21842 @@ -306,9 +306,6 @@ maven/mavencentral/org.apache.maven.doxia/doxia-core/1.12.0, Apache-2.0, approve maven/mavencentral/org.apache.maven.doxia/doxia-logging-api/1.12.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.maven.doxia/doxia-module-xdoc/1.12.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.maven.doxia/doxia-sink-api/1.12.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.sshd/sshd-common/2.12.1, Apache-2.0 AND ISC, approved, #12842 -maven/mavencentral/org.apache.sshd/sshd-core/2.12.1, Apache-2.0, approved, #12841 -maven/mavencentral/org.apache.sshd/sshd-sftp/2.12.1, Apache-2.0, approved, #12840 maven/mavencentral/org.apache.velocity.tools/velocity-tools-generic/3.1, Apache-2.0, approved, #9331 maven/mavencentral/org.apache.velocity/velocity-engine-core/2.3, Apache-2.0, approved, #2478 maven/mavencentral/org.apache.velocity/velocity-engine-scripting/2.3, Apache-2.0, approved, clearlydefined @@ -318,11 +315,11 @@ maven/mavencentral/org.assertj/assertj-core/3.25.3, Apache-2.0, approved, #12585 maven/mavencentral/org.awaitility/awaitility/4.2.0, Apache-2.0, approved, #14178 maven/mavencentral/org.awaitility/awaitility/4.2.1, Apache-2.0, approved, #14178 maven/mavencentral/org.bouncycastle/bcpkix-jdk18on/1.72, MIT, approved, #3789 -maven/mavencentral/org.bouncycastle/bcpkix-jdk18on/1.77, MIT, approved, #11593 +maven/mavencentral/org.bouncycastle/bcpkix-jdk18on/1.78, MIT, approved, #14235 maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.72, MIT AND CC0-1.0, approved, #3538 -maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.77, MIT AND CC0-1.0, approved, #11595 +maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.78, MIT AND CC0-1.0, approved, #14237 maven/mavencentral/org.bouncycastle/bcutil-jdk18on/1.72, MIT, approved, #3790 -maven/mavencentral/org.bouncycastle/bcutil-jdk18on/1.77, MIT, approved, #11596 +maven/mavencentral/org.bouncycastle/bcutil-jdk18on/1.78, MIT, approved, #14238 maven/mavencentral/org.ccil.cowan.tagsoup/tagsoup/1.2.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.checkerframework/checker-qual/3.12.0, MIT, approved, clearlydefined maven/mavencentral/org.checkerframework/checker-qual/3.42.0, MIT, approved, clearlydefined @@ -333,179 +330,181 @@ maven/mavencentral/org.codehaus.plexus/plexus-utils/3.1.1, , approved, CQ16492 maven/mavencentral/org.codehaus.plexus/plexus-utils/3.3.0, , approved, CQ21066 maven/mavencentral/org.codehaus.woodstox/stax2-api/4.2.2, BSD-2-Clause, approved, #2670 maven/mavencentral/org.eclipse.angus/angus-activation/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.eclipse.edc/accesstokendata-store-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/api-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/api-observability/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/asset-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/asset-index-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/asset-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/auth-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/auth-tokenbased/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/autodoc-processor/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/aws-s3-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/aws-s3-test/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/azure-blob-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/azure-test/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/boot-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/boot-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/boot/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/callback-event-dispatcher/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/callback-http-dispatcher/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/catalog-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/catalog-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/configuration-filesystem/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/connector-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/contract-agreement-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/contract-definition-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/contract-definition-store-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/contract-negotiation-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/contract-negotiation-store-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/contract-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-api-configuration/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-aggregate-services/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-api-client-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-api-client/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-catalog/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-contract/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-policies-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-transfer/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/control-plane-transform/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/core-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/crypto-common-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-address-http-data-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-aws-s3/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-azure-storage/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-client-embedded/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-control-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-http-oauth2-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-http-oauth2/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-http-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-http/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-public-api-v2/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-selector-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-selector-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-signaling-api-configuration/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-signaling-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-signaling-client/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-signaling-transform/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-store-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/data-plane-util/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-catalog-http-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-catalog-http-dispatcher/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-catalog-transform/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-catalog/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-http-api-configuration/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-http-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-http-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-negotiation-http-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-negotiation-http-dispatcher/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-negotiation-transform/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-negotiation/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-transfer-process-http-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-transfer-process-http-dispatcher/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-transfer-process-transform/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-transfer-process/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp-version-http-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/dsp/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/edr-index-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/edr-store-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/edr-store-receiver/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/edr-store-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/http-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/http-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/http/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/iam-mock/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-did-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-did-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-did-web/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-credentials/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-did-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-did/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-keypairs/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-participants/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-hub-store-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-issuers-configuration/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-service/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-sts-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-sts-client-configuration/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-sts-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-sts-embedded/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-sts-remote-client/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-sts-remote-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-sts-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/identity-trust-transform/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jersey-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jersey-micrometer/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jersey-providers-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jetty-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jetty-micrometer/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/json-ld-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/json-ld-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/json-ld/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/junit-base/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/junit/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jws2020-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jwt-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/jwt-verifiable-credentials/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/keys-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/keys-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/ldp-verifiable-credentials/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/management-api-configuration/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/management-api-test-fixtures/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/management-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/micrometer-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/oauth2-client/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/oauth2-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-definition-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-definition-store-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-engine-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-engine-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-evaluator-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-model/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-monitor-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-monitor-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-monitor-store-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/policy-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/query-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/runtime-metamodel/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/security/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/sql-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/sql-lease/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/sql-pool-apache-commons/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/state-machine-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/store-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/token-core/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/token-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transaction-datasource-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transaction-local/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transaction-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transfer-data-plane-signaling/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transfer-data-plane-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transfer-process-api/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transfer-process-store-sql/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transfer-pull-http-dynamic-receiver/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transfer-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transform-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/transform-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/util-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/validator-data-address-http-data/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/validator-lib/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/validator-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/vault-azure/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/vault-hashicorp/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/verifiable-credentials-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/verifiable-credentials/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc -maven/mavencentral/org.eclipse.edc/web-spi/0.6.1-20240405-SNAPSHOT, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/accesstokendata-store-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/api-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/api-observability/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/asset-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/asset-index-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/asset-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/auth-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/auth-tokenbased/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/autodoc-processor/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/aws-s3-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/aws-s3-test/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/azure-blob-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/azure-test/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/boot-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/boot-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/boot/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/callback-event-dispatcher/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/callback-http-dispatcher/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/callback-static-endpoint/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/catalog-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/catalog-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/configuration-filesystem/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/connector-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/contract-agreement-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/contract-definition-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/contract-definition-store-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/contract-negotiation-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/contract-negotiation-store-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/contract-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-api-configuration/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-aggregate-services/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-api-client-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-api-client/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-catalog/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-contract/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-policies-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-transfer/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/control-plane-transform/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/core-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/crypto-common-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-address-http-data-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-aws-s3/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-azure-storage/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-client-embedded/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-control-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-http-oauth2-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-http-oauth2/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-http-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-http/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-public-api-v2/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-selector-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-selector-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-signaling-api-configuration/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-signaling-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-signaling-client/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-signaling-transform/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-store-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/data-plane-util/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-catalog-http-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-catalog-http-dispatcher/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-catalog-transform/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-catalog/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-http-api-configuration/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-http-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-http-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-negotiation-http-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-negotiation-http-dispatcher/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-negotiation-transform/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-negotiation/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-transfer-process-http-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-transfer-process-http-dispatcher/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-transfer-process-transform/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-transfer-process/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp-version-http-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/dsp/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/edr-index-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/edr-store-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/edr-store-receiver/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/edr-store-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/http-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/http-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/http/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/iam-mock/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-did-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-did-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-did-web/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-credentials/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-did-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-did/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-keypairs/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-participants/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-hub-store-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-issuers-configuration/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-service/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-sts-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-sts-client-configuration/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-sts-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-sts-embedded/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-sts-remote-client/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-sts-remote-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-sts-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/identity-trust-transform/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jersey-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jersey-micrometer/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jersey-providers-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jetty-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jetty-micrometer/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/json-ld-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/json-ld-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/json-ld/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/json-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/junit-base/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/junit/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jws2020-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jwt-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/jwt-verifiable-credentials/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/keys-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/keys-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/ldp-verifiable-credentials/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/management-api-configuration/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/management-api-test-fixtures/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/management-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/micrometer-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/oauth2-client/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/oauth2-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-definition-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-definition-store-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-engine-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-engine-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-evaluator-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-model/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-monitor-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-monitor-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-monitor-store-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/policy-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/query-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/runtime-metamodel/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/security/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/sql-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/sql-lease/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/sql-pool-apache-commons/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/state-machine-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/store-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/token-core/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/token-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transaction-datasource-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transaction-local/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transaction-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transfer-data-plane-signaling/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transfer-data-plane-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transfer-process-api/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transfer-process-store-sql/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transfer-pull-http-dynamic-receiver/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transfer-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transform-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/transform-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/util-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/validator-data-address-http-data/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/validator-lib/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/validator-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/vault-azure/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/vault-hashicorp/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/verifiable-credentials-spi/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/verifiable-credentials/0.6.1, Apache-2.0, approved, technology.edc +maven/mavencentral/org.eclipse.edc/web-spi/0.6.1, Apache-2.0, approved, technology.edc maven/mavencentral/org.eclipse.jetty.toolchain/jetty-jakarta-servlet-api/5.0.2, EPL-2.0 OR Apache-2.0, approved, rt.jetty maven/mavencentral/org.eclipse.jetty.toolchain/jetty-jakarta-websocket-api/2.0.0, EPL-2.0 OR Apache-2.0, approved, rt.jetty maven/mavencentral/org.eclipse.jetty.websocket/websocket-core-client/11.0.20, EPL-2.0 OR Apache-2.0, approved, rt.jetty @@ -528,8 +527,8 @@ maven/mavencentral/org.eclipse.jetty/jetty-servlet/11.0.20, EPL-2.0 OR Apache-2. maven/mavencentral/org.eclipse.jetty/jetty-util/11.0.20, EPL-2.0 OR Apache-2.0, approved, rt.jetty maven/mavencentral/org.eclipse.jetty/jetty-webapp/11.0.20, EPL-2.0 OR Apache-2.0, approved, rt.jetty maven/mavencentral/org.eclipse.jetty/jetty-xml/11.0.20, EPL-2.0 OR Apache-2.0, approved, rt.jetty -maven/mavencentral/org.flywaydb/flyway-core/10.10.0, Apache-2.0, approved, #14163 -maven/mavencentral/org.flywaydb/flyway-database-postgresql/10.10.0, Apache-2.0, approved, #14158 +maven/mavencentral/org.flywaydb/flyway-core/10.11.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.flywaydb/flyway-database-postgresql/10.11.0, Apache-2.0, approved, #14239 maven/mavencentral/org.glassfish.hk2.external/aopalliance-repackaged/3.0.5, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.glassfish maven/mavencentral/org.glassfish.hk2/hk2-api/3.0.5, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.glassfish maven/mavencentral/org.glassfish.hk2/hk2-locator/3.0.5, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.glassfish @@ -605,11 +604,9 @@ maven/mavencentral/org.postgresql/postgresql/42.7.3, BSD-2-Clause AND Apache-2.0 maven/mavencentral/org.reactivestreams/reactive-streams/1.0.4, CC0-1.0, approved, CQ16332 maven/mavencentral/org.reflections/reflections/0.10.2, Apache-2.0 AND WTFPL, approved, clearlydefined maven/mavencentral/org.rnorth.duct-tape/duct-tape/1.0.8, MIT, approved, clearlydefined -maven/mavencentral/org.slf4j/jcl-over-slf4j/1.7.32, Apache-2.0, approved, CQ12843 maven/mavencentral/org.slf4j/slf4j-api/1.7.22, MIT, approved, CQ11943 maven/mavencentral/org.slf4j/slf4j-api/1.7.25, MIT, approved, CQ13368 maven/mavencentral/org.slf4j/slf4j-api/1.7.30, MIT, approved, CQ13368 -maven/mavencentral/org.slf4j/slf4j-api/1.7.32, MIT, approved, CQ13368 maven/mavencentral/org.slf4j/slf4j-api/1.7.33, MIT, approved, CQ13368 maven/mavencentral/org.slf4j/slf4j-api/1.7.35, MIT, approved, CQ13368 maven/mavencentral/org.slf4j/slf4j-api/1.7.36, MIT, approved, CQ13368 @@ -630,58 +627,58 @@ maven/mavencentral/org.yaml/snakeyaml/1.33, Apache-2.0, approved, clearlydefined maven/mavencentral/org.yaml/snakeyaml/2.0, Apache-2.0 AND (Apache-2.0 OR BSD-3-Clause OR EPL-1.0 OR GPL-2.0-or-later OR LGPL-2.1-or-later), approved, #7275 maven/mavencentral/org.yaml/snakeyaml/2.2, Apache-2.0 AND (Apache-2.0 OR BSD-3-Clause OR EPL-1.0 OR GPL-2.0-or-later OR LGPL-2.1-or-later), approved, #10232 maven/mavencentral/software.amazon.awssdk/annotations/2.24.10, Apache-2.0, approved, #13251 -maven/mavencentral/software.amazon.awssdk/annotations/2.25.21, Apache-2.0, approved, #13691 +maven/mavencentral/software.amazon.awssdk/annotations/2.25.26, Apache-2.0, approved, #13691 maven/mavencentral/software.amazon.awssdk/apache-client/2.24.10, Apache-2.0, approved, #13257 -maven/mavencentral/software.amazon.awssdk/apache-client/2.25.21, Apache-2.0, approved, #13687 +maven/mavencentral/software.amazon.awssdk/apache-client/2.25.26, Apache-2.0, approved, #13687 maven/mavencentral/software.amazon.awssdk/arns/2.24.10, Apache-2.0, approved, #13243 -maven/mavencentral/software.amazon.awssdk/arns/2.25.21, Apache-2.0, approved, #13695 +maven/mavencentral/software.amazon.awssdk/arns/2.25.26, Apache-2.0, approved, #13695 maven/mavencentral/software.amazon.awssdk/auth/2.24.10, Apache-2.0, approved, #13256 -maven/mavencentral/software.amazon.awssdk/auth/2.25.21, Apache-2.0, approved, #13692 +maven/mavencentral/software.amazon.awssdk/auth/2.25.26, Apache-2.0, approved, #13692 maven/mavencentral/software.amazon.awssdk/aws-core/2.24.10, Apache-2.0, approved, #13240 -maven/mavencentral/software.amazon.awssdk/aws-core/2.25.21, Apache-2.0, approved, #13702 +maven/mavencentral/software.amazon.awssdk/aws-core/2.25.26, Apache-2.0, approved, #13702 maven/mavencentral/software.amazon.awssdk/aws-query-protocol/2.24.10, Apache-2.0, approved, #13262 -maven/mavencentral/software.amazon.awssdk/aws-query-protocol/2.25.21, Apache-2.0, approved, #13701 +maven/mavencentral/software.amazon.awssdk/aws-query-protocol/2.25.26, Apache-2.0, approved, #13701 maven/mavencentral/software.amazon.awssdk/aws-xml-protocol/2.24.10, Apache-2.0, approved, #13247 -maven/mavencentral/software.amazon.awssdk/aws-xml-protocol/2.25.21, Apache-2.0, approved, #13684 +maven/mavencentral/software.amazon.awssdk/aws-xml-protocol/2.25.26, Apache-2.0, approved, #13684 maven/mavencentral/software.amazon.awssdk/checksums-spi/2.24.10, Apache-2.0, approved, #13245 -maven/mavencentral/software.amazon.awssdk/checksums-spi/2.25.21, Apache-2.0, approved, #13686 +maven/mavencentral/software.amazon.awssdk/checksums-spi/2.25.26, Apache-2.0, approved, #13686 maven/mavencentral/software.amazon.awssdk/checksums/2.24.10, Apache-2.0, approved, #13242 -maven/mavencentral/software.amazon.awssdk/checksums/2.25.21, Apache-2.0, approved, #13677 +maven/mavencentral/software.amazon.awssdk/checksums/2.25.26, Apache-2.0, approved, #13677 maven/mavencentral/software.amazon.awssdk/crt-core/2.24.10, Apache-2.0, approved, #13252 -maven/mavencentral/software.amazon.awssdk/crt-core/2.25.21, Apache-2.0, approved, #13705 +maven/mavencentral/software.amazon.awssdk/crt-core/2.25.26, Apache-2.0, approved, #13705 maven/mavencentral/software.amazon.awssdk/endpoints-spi/2.24.10, Apache-2.0, approved, #13246 -maven/mavencentral/software.amazon.awssdk/endpoints-spi/2.25.21, Apache-2.0, approved, #13681 +maven/mavencentral/software.amazon.awssdk/endpoints-spi/2.25.26, Apache-2.0, approved, #13681 maven/mavencentral/software.amazon.awssdk/http-auth-aws/2.24.10, Apache-2.0, approved, #13253 -maven/mavencentral/software.amazon.awssdk/http-auth-aws/2.25.21, Apache-2.0, approved, #13696 +maven/mavencentral/software.amazon.awssdk/http-auth-aws/2.25.26, Apache-2.0, approved, #13696 maven/mavencentral/software.amazon.awssdk/http-auth-spi/2.24.10, Apache-2.0, approved, #13264 -maven/mavencentral/software.amazon.awssdk/http-auth-spi/2.25.21, Apache-2.0, approved, #13704 +maven/mavencentral/software.amazon.awssdk/http-auth-spi/2.25.26, Apache-2.0, approved, #13704 maven/mavencentral/software.amazon.awssdk/http-auth/2.24.10, Apache-2.0, approved, #13248 -maven/mavencentral/software.amazon.awssdk/http-auth/2.25.21, Apache-2.0, approved, #13682 +maven/mavencentral/software.amazon.awssdk/http-auth/2.25.26, Apache-2.0, approved, #13682 maven/mavencentral/software.amazon.awssdk/http-client-spi/2.24.10, Apache-2.0, approved, #13259 -maven/mavencentral/software.amazon.awssdk/http-client-spi/2.25.21, Apache-2.0, approved, #13706 +maven/mavencentral/software.amazon.awssdk/http-client-spi/2.25.26, Apache-2.0, approved, #13706 maven/mavencentral/software.amazon.awssdk/iam/2.24.10, Apache-2.0, approved, #13444 maven/mavencentral/software.amazon.awssdk/identity-spi/2.24.10, Apache-2.0, approved, #13244 -maven/mavencentral/software.amazon.awssdk/identity-spi/2.25.21, Apache-2.0, approved, #13685 +maven/mavencentral/software.amazon.awssdk/identity-spi/2.25.26, Apache-2.0, approved, #13685 maven/mavencentral/software.amazon.awssdk/json-utils/2.24.10, Apache-2.0, approved, #13261 -maven/mavencentral/software.amazon.awssdk/json-utils/2.25.21, Apache-2.0, approved, #13698 +maven/mavencentral/software.amazon.awssdk/json-utils/2.25.26, Apache-2.0, approved, #13698 maven/mavencentral/software.amazon.awssdk/metrics-spi/2.24.10, Apache-2.0, approved, #13239 -maven/mavencentral/software.amazon.awssdk/metrics-spi/2.25.21, Apache-2.0, approved, #13680 +maven/mavencentral/software.amazon.awssdk/metrics-spi/2.25.26, Apache-2.0, approved, #13680 maven/mavencentral/software.amazon.awssdk/netty-nio-client/2.24.10, Apache-2.0, approved, #13260 -maven/mavencentral/software.amazon.awssdk/netty-nio-client/2.25.21, Apache-2.0, approved, #13693 +maven/mavencentral/software.amazon.awssdk/netty-nio-client/2.25.26, Apache-2.0, approved, #13693 maven/mavencentral/software.amazon.awssdk/profiles/2.24.10, Apache-2.0, approved, #13258 -maven/mavencentral/software.amazon.awssdk/profiles/2.25.21, Apache-2.0, approved, #13697 +maven/mavencentral/software.amazon.awssdk/profiles/2.25.26, Apache-2.0, approved, #13697 maven/mavencentral/software.amazon.awssdk/protocol-core/2.24.10, Apache-2.0, approved, #13241 -maven/mavencentral/software.amazon.awssdk/protocol-core/2.25.21, Apache-2.0, approved, #13679 +maven/mavencentral/software.amazon.awssdk/protocol-core/2.25.26, Apache-2.0, approved, #13679 maven/mavencentral/software.amazon.awssdk/regions/2.24.10, Apache-2.0, approved, #13255 -maven/mavencentral/software.amazon.awssdk/regions/2.25.21, Apache-2.0, approved, #13694 -maven/mavencentral/software.amazon.awssdk/s3-transfer-manager/2.25.21, Apache-2.0, approved, #13699 +maven/mavencentral/software.amazon.awssdk/regions/2.25.26, Apache-2.0, approved, #13694 +maven/mavencentral/software.amazon.awssdk/s3-transfer-manager/2.25.26, Apache-2.0, approved, #13699 maven/mavencentral/software.amazon.awssdk/s3/2.24.10, Apache-2.0, approved, #13254 -maven/mavencentral/software.amazon.awssdk/s3/2.25.21, Apache-2.0, approved, #13688 +maven/mavencentral/software.amazon.awssdk/s3/2.25.26, Apache-2.0, approved, #13688 maven/mavencentral/software.amazon.awssdk/sdk-core/2.24.10, Apache-2.0, approved, #13265 -maven/mavencentral/software.amazon.awssdk/sdk-core/2.25.21, Apache-2.0, approved, #13700 +maven/mavencentral/software.amazon.awssdk/sdk-core/2.25.26, Apache-2.0, approved, #13700 maven/mavencentral/software.amazon.awssdk/sts/2.24.10, Apache-2.0, approved, #13442 maven/mavencentral/software.amazon.awssdk/third-party-jackson-core/2.24.10, Apache-2.0, approved, #13249 -maven/mavencentral/software.amazon.awssdk/third-party-jackson-core/2.25.21, Apache-2.0, approved, #13703 +maven/mavencentral/software.amazon.awssdk/third-party-jackson-core/2.25.26, Apache-2.0, approved, #13703 maven/mavencentral/software.amazon.awssdk/utils/2.24.10, Apache-2.0, approved, #13250 -maven/mavencentral/software.amazon.awssdk/utils/2.25.21, Apache-2.0, approved, #13689 +maven/mavencentral/software.amazon.awssdk/utils/2.25.26, Apache-2.0, approved, #13689 maven/mavencentral/software.amazon.eventstream/eventstream/1.0.1, Apache-2.0, approved, clearlydefined diff --git a/build.gradle.kts b/build.gradle.kts index 6b27934d4..4053f5892 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,7 +28,7 @@ plugins { `jacoco-report-aggregation` id("com.github.johnrengelman.shadow") version "8.1.1" id("com.bmuschko.docker-remote-api") version "9.4.0" - id("io.github.gradle-nexus.publish-plugin") version "1.3.0" + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" } val txScmConnection: String by project diff --git a/charts/tractusx-connector-azure-vault/Chart.yaml b/charts/tractusx-connector-azure-vault/Chart.yaml index 0ff024d86..12965ca6c 100644 --- a/charts/tractusx-connector-azure-vault/Chart.yaml +++ b/charts/tractusx-connector-azure-vault/Chart.yaml @@ -41,12 +41,12 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.7.0-rc1 +version: 0.7.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.7.0-rc1" +appVersion: "0.7.0" home: https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector sources: - https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector diff --git a/charts/tractusx-connector-azure-vault/README.md b/charts/tractusx-connector-azure-vault/README.md index f4a42d029..4376e4a41 100644 --- a/charts/tractusx-connector-azure-vault/README.md +++ b/charts/tractusx-connector-azure-vault/README.md @@ -1,6 +1,6 @@ # tractusx-connector-azure-vault -![Version: 0.7.0-rc1](https://img.shields.io/badge/Version-0.7.0--rc1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0-rc1](https://img.shields.io/badge/AppVersion-0.7.0--rc1-informational?style=flat-square) +![Version: 0.7.0](https://img.shields.io/badge/Version-0.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0](https://img.shields.io/badge/AppVersion-0.7.0-informational?style=flat-square) A Helm chart for Tractus-X Eclipse Data Space Connector. The connector deployment consists of two runtime consists of a Control Plane and a Data Plane. Note that _no_ external dependencies such as a PostgreSQL database and Azure KeyVault are included. @@ -9,33 +9,32 @@ This chart is intended for use with an _existing_ PostgreSQL database and an _ex **Homepage:** -## Setting up SSI +## Setting up IATP ### Preconditions -- the [Managed Identity Walled (MIW)](https://github.com/eclipse-tractusx/managed-identity-wallet) must be running and reachable via network -- the necessary set of VerifiableCredentials for this participant must be pushed to MIW. This is typically done by the +- You'll need an account with DIM, the wallet for VerifiableCredentials +- the necessary set of VerifiableCredentials for this participant must already be issued to your DIM tenant. This is typically done by the Portal during participant onboarding -- KeyCloak must be running and reachable via network -- an account with KeyCloak must be created for this BPN and the connector must be able to obtain access tokens - the client ID and client secret corresponding to that account must be known ### Preparatory work -- store your KeyCloak client secret in the Azure KeyVault. The exact procedure is as follows: - ```bash - az keyvault secret set --vault-name --name client-secret --value "$YOUR_CLIENT_SECRET" - ``` - By default, Tractus-X EDC expects to find the secret under `client-secret`. +- store client secret in the HashiCorp vault using an alias. The exact procedure will depend on your deployment of HashiCorp Vault and + is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. The alias must be configured + using the `iatp.sts.oauth.client.secret_alias` Helm value. ### Configure the chart Be sure to provide the following configuration entries to your Tractus-X EDC Helm chart: -- `controlplane.ssi.miw.url`: the URL -- `controlplane.ssi.miw.authorityId`: the BPN of the issuer authority -- `controlplane.ssi.oauth.tokenurl`: the URL (of KeyCloak), where access tokens can be obtained -- `controlplane.ssi.oauth.client.id`: client ID for KeyCloak -- `controlplane.ssi.oauth.client.secretAlias`: the alias under which the client secret is stored in the vault. Defaults to `client-secret`. +- `iatp.sts.oauth.token_url`: the token endpoint of DIM +- `iatp.sts.oauth.client.id`: the client ID of your tenant in DIM +- `iatp.sts.oauth.client.secret_alias`: alias under which you saved your DIM client secret in the vault +- `iatp.sts.dim.url`: the base URL for DIM + +In addition, in order to map BPNs to DIDs, a new service is required, called the BPN-DID Resolution Service, which +must be configured: +- `controlplane.bdrs.server.url`: base URL of the BPN-DID Resolution Service ("BDRS") ### Launching the application @@ -45,7 +44,7 @@ Combined, run this shell command to start the in-memory Tractus-X EDC runtime: ```shell helm repo add tractusx-edc https://eclipse-tractusx.github.io/charts/dev -helm install my-release tractusx-edc/tractusx-connector-azure-vault --version 0.7.0-rc1 \ +helm install my-release tractusx-edc/tractusx-connector-azure-vault --version 0.7.0 \ -f /tractusx-connector-azure-vault-test.yaml \ --set vault.azure.name=$AZURE_VAULT_NAME \ --set vault.azure.client=$AZURE_CLIENT_ID \ diff --git a/charts/tractusx-connector-azure-vault/README.md.gotmpl b/charts/tractusx-connector-azure-vault/README.md.gotmpl index 4823545b3..cb5cc10e6 100644 --- a/charts/tractusx-connector-azure-vault/README.md.gotmpl +++ b/charts/tractusx-connector-azure-vault/README.md.gotmpl @@ -8,35 +8,33 @@ {{ template "chart.homepageLine" . }} -## Setting up SSI +## Setting up IATP ### Preconditions -- the [Managed Identity Walled (MIW)](https://github.com/eclipse-tractusx/managed-identity-wallet) must be running and reachable via network -- the necessary set of VerifiableCredentials for this participant must be pushed to MIW. This is typically done by the +- You'll need an account with DIM, the wallet for VerifiableCredentials +- the necessary set of VerifiableCredentials for this participant must already be issued to your DIM tenant. This is typically done by the Portal during participant onboarding -- KeyCloak must be running and reachable via network -- an account with KeyCloak must be created for this BPN and the connector must be able to obtain access tokens - the client ID and client secret corresponding to that account must be known ### Preparatory work -- store your KeyCloak client secret in the Azure KeyVault. The exact procedure is as follows: - ```bash - az keyvault secret set --vault-name --name client-secret --value "$YOUR_CLIENT_SECRET" - ``` - By default, Tractus-X EDC expects to find the secret under `client-secret`. +- store client secret in the HashiCorp vault using an alias. The exact procedure will depend on your deployment of HashiCorp Vault and + is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. The alias must be configured + using the `iatp.sts.oauth.client.secret_alias` Helm value. ### Configure the chart Be sure to provide the following configuration entries to your Tractus-X EDC Helm chart: -- `controlplane.ssi.miw.url`: the URL -- `controlplane.ssi.miw.authorityId`: the BPN of the issuer authority -- `controlplane.ssi.oauth.tokenurl`: the URL (of KeyCloak), where access tokens can be obtained -- `controlplane.ssi.oauth.client.id`: client ID for KeyCloak -- `controlplane.ssi.oauth.client.secretAlias`: the alias under which the client secret is stored in the vault. Defaults to `client-secret`. +- `iatp.sts.oauth.token_url`: the token endpoint of DIM +- `iatp.sts.oauth.client.id`: the client ID of your tenant in DIM +- `iatp.sts.oauth.client.secret_alias`: alias under which you saved your DIM client secret in the vault +- `iatp.sts.dim.url`: the base URL for DIM +In addition, in order to map BPNs to DIDs, a new service is required, called the BPN-DID Resolution Service, which +must be configured: +- `controlplane.bdrs.server.url`: base URL of the BPN-DID Resolution Service ("BDRS") ### Launching the application @@ -54,7 +52,6 @@ helm install my-release tractusx-edc/tractusx-connector-azure-vault --version {{ --set vault.azure.tenant=$AZURE_TENANT_ID ``` - {{ template "chart.maintainersSection" . }} {{ template "chart.sourcesSection" . }} diff --git a/charts/tractusx-connector-memory/Chart.yaml b/charts/tractusx-connector-memory/Chart.yaml index 919bff1ad..8b18212ed 100644 --- a/charts/tractusx-connector-memory/Chart.yaml +++ b/charts/tractusx-connector-memory/Chart.yaml @@ -35,12 +35,12 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.7.0-rc1 +version: 0.7.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.7.0-rc1" +appVersion: "0.7.0" home: https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector-memory sources: - https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector-memory diff --git a/charts/tractusx-connector-memory/README.md b/charts/tractusx-connector-memory/README.md index c01e61614..f6fb0d244 100644 --- a/charts/tractusx-connector-memory/README.md +++ b/charts/tractusx-connector-memory/README.md @@ -1,35 +1,37 @@ # tractusx-connector-memory -![Version: 0.7.0-rc1](https://img.shields.io/badge/Version-0.7.0--rc1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0-rc1](https://img.shields.io/badge/AppVersion-0.7.0--rc1-informational?style=flat-square) +![Version: 0.7.0](https://img.shields.io/badge/Version-0.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0](https://img.shields.io/badge/AppVersion-0.7.0-informational?style=flat-square) A Helm chart for Tractus-X Eclipse Data Space Connector based on memory. Please only use this for development or testing purposes, never in production workloads! **Homepage:** -## Setting up SSI +## Setting up IATP ### Preconditions -- the [Managed Identity Walled (MIW)](https://github.com/eclipse-tractusx/managed-identity-wallet) must be running and reachable via network -- the necessary set of VerifiableCredentials for this participant must be pushed to MIW. This is typically done by the +- You'll need an account with DIM, the wallet for VerifiableCredentials +- the necessary set of VerifiableCredentials for this participant must already be issued to your DIM tenant. This is typically done by the Portal during participant onboarding -- KeyCloak must be running and reachable via network -- an account with KeyCloak must be created for this BPN and the connector must be able to obtain access tokens - the client ID and client secret corresponding to that account must be known ### Preparatory work -- store your KeyCloak client secret in the HashiCorp vault. The exact procedure will depend on your deployment of HashiCorp Vault and - is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. +- store client secret in the HashiCorp vault using an alias. The exact procedure will depend on your deployment of HashiCorp Vault and + is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. The alias must be configured + using the `iatp.sts.oauth.client.secret_alias` Helm value. ### Configure the chart Be sure to provide the following configuration entries to your Tractus-X EDC Helm chart: -- `runtime.ssi.miw.url`: the URL -- `runtime.ssi.miw.authorityId`: the BPN of the issuer authority -- `runtime.ssi.oauth.tokenurl`: the URL (of KeyCloak), where access tokens can be obtained -- `runtime.ssi.oauth.client.id`: client ID for KeyCloak -- `runtime.ssi.oauth.client.secretAlias`: the alias under which the client secret is stored in the vault. Defaults to `client-secret`. +- `iatp.sts.oauth.token_url`: the token endpoint of DIM +- `iatp.sts.oauth.client.id`: the client ID of your tenant in DIM +- `iatp.sts.oauth.client.secret_alias`: alias under which you saved your DIM client secret in the vault +- `iatp.sts.dim.url`: the base URL for DIM + +In addition, in order to map BPNs to DIDs, a new service is required, called the BPN-DID Resolution Service, which +must be configured: +- `controlplane.bdrs.server.url`: base URL of the BPN-DID Resolution Service ("BDRS") ### Launching the application @@ -39,7 +41,7 @@ Combined, run this shell command to start the in-memory Tractus-X EDC runtime: ```shell helm repo add tractusx-edc https://eclipse-tractusx.github.io/charts/dev -helm install my-release tractusx-edc/tractusx-connector-memory --version 0.7.0-rc1 \ +helm install my-release tractusx-edc/tractusx-connector-memory --version 0.7.0 \ -f /tractusx-connector-memory-test.yaml \ --set vault.secrets="client-secret:$YOUR_CLIENT_SECRET" ``` diff --git a/charts/tractusx-connector-memory/README.md.gotmpl b/charts/tractusx-connector-memory/README.md.gotmpl index a5d149876..fd4b05c2c 100644 --- a/charts/tractusx-connector-memory/README.md.gotmpl +++ b/charts/tractusx-connector-memory/README.md.gotmpl @@ -8,32 +8,33 @@ {{ template "chart.homepageLine" . }} -## Setting up SSI +## Setting up IATP ### Preconditions -- the [Managed Identity Walled (MIW)](https://github.com/eclipse-tractusx/managed-identity-wallet) must be running and reachable via network -- the necessary set of VerifiableCredentials for this participant must be pushed to MIW. This is typically done by the +- You'll need an account with DIM, the wallet for VerifiableCredentials +- the necessary set of VerifiableCredentials for this participant must already be issued to your DIM tenant. This is typically done by the Portal during participant onboarding -- KeyCloak must be running and reachable via network -- an account with KeyCloak must be created for this BPN and the connector must be able to obtain access tokens - the client ID and client secret corresponding to that account must be known ### Preparatory work -- store your KeyCloak client secret in the HashiCorp vault. The exact procedure will depend on your deployment of HashiCorp Vault and - is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. +- store client secret in the HashiCorp vault using an alias. The exact procedure will depend on your deployment of HashiCorp Vault and + is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. The alias must be configured + using the `iatp.sts.oauth.client.secret_alias` Helm value. ### Configure the chart Be sure to provide the following configuration entries to your Tractus-X EDC Helm chart: -- `runtime.ssi.miw.url`: the URL -- `runtime.ssi.miw.authorityId`: the BPN of the issuer authority -- `runtime.ssi.oauth.tokenurl`: the URL (of KeyCloak), where access tokens can be obtained -- `runtime.ssi.oauth.client.id`: client ID for KeyCloak -- `runtime.ssi.oauth.client.secretAlias`: the alias under which the client secret is stored in the vault. Defaults to `client-secret`. - +- `iatp.sts.oauth.token_url`: the token endpoint of DIM +- `iatp.sts.oauth.client.id`: the client ID of your tenant in DIM +- `iatp.sts.oauth.client.secret_alias`: alias under which you saved your DIM client secret in the vault +- `iatp.sts.dim.url`: the base URL for DIM + +In addition, in order to map BPNs to DIDs, a new service is required, called the BPN-DID Resolution Service, which +must be configured: +- `controlplane.bdrs.server.url`: base URL of the BPN-DID Resolution Service ("BDRS") ### Launching the application diff --git a/charts/tractusx-connector/Chart.yaml b/charts/tractusx-connector/Chart.yaml index ed18a582e..5d24a9893 100644 --- a/charts/tractusx-connector/Chart.yaml +++ b/charts/tractusx-connector/Chart.yaml @@ -41,12 +41,12 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.7.0-rc1 +version: 0.7.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "0.7.0-rc1" +appVersion: "0.7.0" home: https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector sources: - https://github.com/eclipse-tractusx/tractusx-edc/tree/main/charts/tractusx-connector diff --git a/charts/tractusx-connector/README.md b/charts/tractusx-connector/README.md index a734c214a..39737c163 100644 --- a/charts/tractusx-connector/README.md +++ b/charts/tractusx-connector/README.md @@ -1,6 +1,6 @@ # tractusx-connector -![Version: 0.7.0-rc1](https://img.shields.io/badge/Version-0.7.0--rc1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0-rc1](https://img.shields.io/badge/AppVersion-0.7.0--rc1-informational?style=flat-square) +![Version: 0.7.0](https://img.shields.io/badge/Version-0.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0](https://img.shields.io/badge/AppVersion-0.7.0-informational?style=flat-square) A Helm chart for Tractus-X Eclipse Data Space Connector. The connector deployment consists of two runtime consists of a Control Plane and a Data Plane. Note that _no_ external dependencies such as a PostgreSQL database and HashiCorp Vault are included. @@ -9,30 +9,32 @@ This chart is intended for use with an _existing_ PostgreSQL database and an _ex **Homepage:** -## Setting up SSI +## Setting up IATP ### Preconditions -- the [Managed Identity Walled (MIW)](https://github.com/eclipse-tractusx/managed-identity-wallet) must be running and reachable via network -- the necessary set of VerifiableCredentials for this participant must be pushed to MIW. This is typically done by the +- You'll need an account with DIM, the wallet for VerifiableCredentials +- the necessary set of VerifiableCredentials for this participant must already be issued to your DIM tenant. This is typically done by the Portal during participant onboarding -- KeyCloak must be running and reachable via network -- an account with KeyCloak must be created for this BPN and the connector must be able to obtain access tokens - the client ID and client secret corresponding to that account must be known ### Preparatory work -- store your KeyCloak client secret in the HashiCorp vault. The exact procedure will depend on your deployment of HashiCorp Vault and - is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. +- store client secret in the HashiCorp vault using an alias. The exact procedure will depend on your deployment of HashiCorp Vault and + is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. The alias must be configured + using the `iatp.sts.oauth.client.secret_alias` Helm value. ### Configure the chart Be sure to provide the following configuration entries to your Tractus-X EDC Helm chart: -- `controlplane.ssi.miw.url`: the URL -- `controlplane.ssi.miw.authorityId`: the BPN of the issuer authority -- `controlplane.ssi.oauth.tokenurl`: the URL (of KeyCloak), where access tokens can be obtained -- `controlplane.ssi.oauth.client.id`: client ID for KeyCloak -- `controlplane.ssi.oauth.client.secretAlias`: the alias under which the client secret is stored in the vault. Defaults to `client-secret`. +- `iatp.sts.oauth.token_url`: the token endpoint of DIM +- `iatp.sts.oauth.client.id`: the client ID of your tenant in DIM +- `iatp.sts.oauth.client.secret_alias`: alias under which you saved your DIM client secret in the vault +- `iatp.sts.dim.url`: the base URL for DIM + +In addition, in order to map BPNs to DIDs, a new service is required, called the BPN-DID Resolution Service, which +must be configured: +- `controlplane.bdrs.server.url`: base URL of the BPN-DID Resolution Service ("BDRS") ### Launching the application @@ -42,7 +44,7 @@ Combined, run this shell command to start the in-memory Tractus-X EDC runtime: ```shell helm repo add tractusx-edc https://eclipse-tractusx.github.io/charts/dev -helm install my-release tractusx-edc/tractusx-connector --version 0.7.0-rc1 \ +helm install my-release tractusx-edc/tractusx-connector --version 0.7.0 \ -f /tractusx-connector-test.yaml ``` diff --git a/charts/tractusx-connector/README.md.gotmpl b/charts/tractusx-connector/README.md.gotmpl index 4b10c8adc..05b0f0f93 100644 --- a/charts/tractusx-connector/README.md.gotmpl +++ b/charts/tractusx-connector/README.md.gotmpl @@ -8,32 +8,33 @@ {{ template "chart.homepageLine" . }} -## Setting up SSI +## Setting up IATP ### Preconditions -- the [Managed Identity Walled (MIW)](https://github.com/eclipse-tractusx/managed-identity-wallet) must be running and reachable via network -- the necessary set of VerifiableCredentials for this participant must be pushed to MIW. This is typically done by the +- You'll need an account with DIM, the wallet for VerifiableCredentials +- the necessary set of VerifiableCredentials for this participant must already be issued to your DIM tenant. This is typically done by the Portal during participant onboarding -- KeyCloak must be running and reachable via network -- an account with KeyCloak must be created for this BPN and the connector must be able to obtain access tokens - the client ID and client secret corresponding to that account must be known ### Preparatory work -- store your KeyCloak client secret in the HashiCorp vault. The exact procedure will depend on your deployment of HashiCorp Vault and - is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. +- store client secret in the HashiCorp vault using an alias. The exact procedure will depend on your deployment of HashiCorp Vault and + is out of scope of this document. But by default, Tractus-X EDC expects to find the secret under `secret/client-secret`. The alias must be configured + using the `iatp.sts.oauth.client.secret_alias` Helm value. ### Configure the chart Be sure to provide the following configuration entries to your Tractus-X EDC Helm chart: -- `controlplane.ssi.miw.url`: the URL -- `controlplane.ssi.miw.authorityId`: the BPN of the issuer authority -- `controlplane.ssi.oauth.tokenurl`: the URL (of KeyCloak), where access tokens can be obtained -- `controlplane.ssi.oauth.client.id`: client ID for KeyCloak -- `controlplane.ssi.oauth.client.secretAlias`: the alias under which the client secret is stored in the vault. Defaults to `client-secret`. - +- `iatp.sts.oauth.token_url`: the token endpoint of DIM +- `iatp.sts.oauth.client.id`: the client ID of your tenant in DIM +- `iatp.sts.oauth.client.secret_alias`: alias under which you saved your DIM client secret in the vault +- `iatp.sts.dim.url`: the base URL for DIM + +In addition, in order to map BPNs to DIDs, a new service is required, called the BPN-DID Resolution Service, which +must be configured: +- `controlplane.bdrs.server.url`: base URL of the BPN-DID Resolution Service ("BDRS") ### Launching the application diff --git a/core/core-utils/src/main/java/org/eclipse/tractusx/edc/core/utils/RequiredConfigWarnings.java b/core/core-utils/src/main/java/org/eclipse/tractusx/edc/core/utils/RequiredConfigWarnings.java index 8a5ad0b87..aa519cbc9 100644 --- a/core/core-utils/src/main/java/org/eclipse/tractusx/edc/core/utils/RequiredConfigWarnings.java +++ b/core/core-utils/src/main/java/org/eclipse/tractusx/edc/core/utils/RequiredConfigWarnings.java @@ -23,7 +23,7 @@ public class RequiredConfigWarnings { - public static void warningNotPresent(Monitor monitor, String missingConfig) { + public static void missingMandatoryProperty(Monitor monitor, String missingConfig) { monitor.severe("Mandatory config value missing: '%s'. This runtime will not be fully operational! Starting with v0.7.x this will be a runtime error.".formatted(missingConfig)); } } diff --git a/core/json-ld-core/src/main/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtension.java b/core/json-ld-core/src/main/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtension.java index 43cdefc81..05e461f36 100644 --- a/core/json-ld-core/src/main/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtension.java +++ b/core/json-ld-core/src/main/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtension.java @@ -34,6 +34,8 @@ import static java.lang.String.format; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.CX_POLICY_NS; +import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.CX_POLICY_PREFIX; import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.EDC_CONTEXT; import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.TX_AUTH_NS; import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.TX_AUTH_PREFIX; @@ -45,19 +47,18 @@ public class JsonLdExtension implements ServiceExtension { public static final String CREDENTIALS_V_1 = "https://www.w3.org/2018/credentials/v1"; - public static final String CREDENTIALS_SUMMARY_V_1 = "https://w3id.org/2023/catenax/credentials/summary/v1"; - public static final String CREDENTIALS_SUMMARY_V_1_FALLBACK = "https://catenax-ng.github.io/product-core-schemas/SummaryVC.json"; public static final String SECURITY_JWS_V1 = "https://w3id.org/security/suites/jws-2020/v1"; public static final String SECURITY_ED25519_V1 = "https://w3id.org/security/suites/ed25519-2020/v1"; + public static final String CX_POLICY_CONTEXT = "https://w3id.org/tractusx/policy/v1.0.0"; + private static final String PREFIX = "document" + File.separator; private static final Map FILES = Map.of( CREDENTIALS_V_1, PREFIX + "credential-v1.jsonld", - CREDENTIALS_SUMMARY_V_1, PREFIX + "summary-vc-context-v1.jsonld", - CREDENTIALS_SUMMARY_V_1_FALLBACK, PREFIX + "summary-vc-context-v1.jsonld", SECURITY_JWS_V1, PREFIX + "security-jws-2020.jsonld", SECURITY_ED25519_V1, PREFIX + "security-ed25519-2020.jsonld", TX_CONTEXT, PREFIX + "tx-v1.jsonld", + CX_POLICY_CONTEXT, PREFIX + "cx-policy-v1.jsonld", EDC_CONTEXT, PREFIX + "edc-v1.jsonld"); @Inject private JsonLd jsonLdService; @@ -69,6 +70,7 @@ public class JsonLdExtension implements ServiceExtension { public void initialize(ServiceExtensionContext context) { jsonLdService.registerNamespace(TX_PREFIX, TX_NAMESPACE); jsonLdService.registerNamespace(TX_AUTH_PREFIX, TX_AUTH_NS); + jsonLdService.registerNamespace(CX_POLICY_PREFIX, CX_POLICY_NS); FILES.entrySet().stream().map(this::mapToFile) .forEach(result -> result.onSuccess(entry -> jsonLdService.registerCachedDocument(entry.getKey(), entry.getValue().toURI())) .onFailure(failure -> monitor.warning("Failed to register cached json-ld document: " + failure.getFailureDetail()))); diff --git a/core/json-ld-core/src/main/resources/document/cx-policy-v1.jsonld b/core/json-ld-core/src/main/resources/document/cx-policy-v1.jsonld new file mode 100644 index 000000000..a4d09fc01 --- /dev/null +++ b/core/json-ld-core/src/main/resources/document/cx-policy-v1.jsonld @@ -0,0 +1,22 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "cred": "https://www.w3.org/2018/credentials#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "cx-policy": "https://w3id.org/catenax/policy/", + "Dismantler": "cx-policy:Dismantler", + "Dismantler.activityType": "cx-policy:Dismantler.activityType", + "Dismantler.allowedBrands": "cx-policy:Dismantler.allowedBrands", + "Membership": "cx-policy:Membership", + "UsagePurpose": "cx-policy:UsagePurpose", + "ContractReference": "cx-policy:ContractReference", + "FrameworkAgreement": "cx-policy:FrameworkAgreement", + "FrameworkAgreement.behavioraltwin": "cx-policy:FrameworkAgreement.behavioraltwin", + "FrameworkAgreement.pcf": "cx-policy:FrameworkAgreement.pcf", + "FrameworkAgreement.quality": "cx-policy:FrameworkAgreement.quality", + "FrameworkAgreement.resiliency": "cx-policy:FrameworkAgreement.resiliency", + "FrameworkAgreement.sustainability": "cx-policy:FrameworkAgreement.sustainability", + "FrameworkAgreement.traceability": "cx-policy:FrameworkAgreement.traceability" + } +} \ No newline at end of file diff --git a/core/json-ld-core/src/main/resources/document/summary-vc-context-v1.jsonld b/core/json-ld-core/src/main/resources/document/summary-vc-context-v1.jsonld deleted file mode 100644 index aabc86bb1..000000000 --- a/core/json-ld-core/src/main/resources/document/summary-vc-context-v1.jsonld +++ /dev/null @@ -1,26 +0,0 @@ -{ - "@context": { - "@version": 1.1, - "@protected": true, - "summary": "https://w3id.org/2023/catenax/credentials/summary/", - "id": "@id", - "type": "@type", - "SummaryCredential": { - "@context": [ - "https://www.w3.org/2018/credentials/v1" - ], - "@id": "summary:SummaryCredential" - }, - "holderIdentifier": { - "@id": "summary:holderIdentifier" - }, - "items": { - "@id": "summary:items", - "@type": "https://schema.org/Text" - }, - "contractTemplate": { - "@id": "summary:contract-template", - "@type": "https://schema.org/Text" - } - } -} \ No newline at end of file diff --git a/core/json-ld-core/src/test/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtensionTest.java b/core/json-ld-core/src/test/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtensionTest.java index 3129111a0..ff2a3d740 100644 --- a/core/json-ld-core/src/test/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtensionTest.java +++ b/core/json-ld-core/src/test/java/org/eclipse/tractusx/edc/jsonld/JsonLdExtensionTest.java @@ -28,8 +28,8 @@ import java.net.URI; -import static org.eclipse.tractusx.edc.jsonld.JsonLdExtension.CREDENTIALS_SUMMARY_V_1; import static org.eclipse.tractusx.edc.jsonld.JsonLdExtension.CREDENTIALS_V_1; +import static org.eclipse.tractusx.edc.jsonld.JsonLdExtension.CX_POLICY_CONTEXT; import static org.eclipse.tractusx.edc.jsonld.JsonLdExtension.SECURITY_ED25519_V1; import static org.eclipse.tractusx.edc.jsonld.JsonLdExtension.SECURITY_JWS_V1; import static org.mockito.ArgumentMatchers.any; @@ -50,7 +50,7 @@ void setup(ServiceExtensionContext context) { void initialize(ServiceExtensionContext context, JsonLdExtension extension) { extension.initialize(context); jsonLdService.registerCachedDocument(eq(CREDENTIALS_V_1), any(URI.class)); - jsonLdService.registerCachedDocument(eq(CREDENTIALS_SUMMARY_V_1), any(URI.class)); + jsonLdService.registerCachedDocument(eq(CX_POLICY_CONTEXT), any(URI.class)); jsonLdService.registerCachedDocument(eq(SECURITY_JWS_V1), any(URI.class)); jsonLdService.registerCachedDocument(eq(SECURITY_ED25519_V1), any(URI.class)); diff --git a/docs/development/decision-records/2024-04-11_remove_sftp/README.md b/docs/development/decision-records/2024-04-11_remove_sftp/README.md new file mode 100644 index 000000000..110bb103b --- /dev/null +++ b/docs/development/decision-records/2024-04-11_remove_sftp/README.md @@ -0,0 +1,14 @@ +# Remove SFTP modules + +## Decision + +Starting with the next release of Tractus-X EDC, the SFTP modules will be removed from the code base. Specifically `transferprocess-sftp-client`, `transferprocess-sftp-common` and `transferprocess-sftp-provisioner`. + +## Rationale + +These modules don't implement any official Catena-X Standard, and as such, have not been part of any official Tractus-X EDC distribution for a significant period of time. +Further, those modules are not up to the coding standards established by Tractus-X EDC, and would have to be refactored significantly. Even then, having dead code in a repository is bad hygiene, as it generates maintenance churn. Tractus-X EDC is not responsible for maintaining niche extensions, that are not officially sanctioned. + +## Approach + +Starting with version `0.8.x` of Tractus-X EDC, these modules will be deleted from the code base. At that time, stakeholders interested in continuing to maintain them are welcome to adopt them into their own repositories. diff --git a/docs/development/decision-records/2024-04-11_txedc_release_train/README.md b/docs/development/decision-records/2024-04-11_txedc_release_train/README.md new file mode 100644 index 000000000..ca4dbea95 --- /dev/null +++ b/docs/development/decision-records/2024-04-11_txedc_release_train/README.md @@ -0,0 +1,21 @@ +# Adopt a more regular release train of Tractus-X EDC + +## Decision + +Starting with `0.8.x`, Tractus-X EDC will adopt a periodic release schedule of 6-8 weeks between versions. This increases the _minor_ version, e.g. `0.8.0 -> 0.9.0` and breaking changes between those versions are to be expected. + +## Rationale + +In an effort to minimize, technical debt, huge change surfaces and the probability of highly intense crunch times before a (Tractus-X) release, Tractus-X EDC will release roughly every two months. +Note that this is completely independent from Tractus-X releases or Catena-X releases. + +We also do this to give early adopters a chance to update their code base to new features and to shorten the feedback loop, as well as reducing the impact on continuous integration and testing, making the overall developer experience more agile and more manageable. + +The EDC project has used this process for a long time with great success. + +_The commitment of the Tractus-X EDC team to maintain (= bugfix) the last version used in a Tractus-X/Catena-X release remains unchanged._ + +## Approach + +Weekly committer meetings serve as forum to do issue triage and priorization. We create GitHub milestones as a means of making our release schedule transparent and we plan issues for those milestones. +The exact release date is determined by the committers and will be publicized in appropriate channels, e.g. Matrix. diff --git a/edc-controlplane/edc-controlplane-base/build.gradle.kts b/edc-controlplane/edc-controlplane-base/build.gradle.kts index c3ef42249..915f73928 100644 --- a/edc-controlplane/edc-controlplane-base/build.gradle.kts +++ b/edc-controlplane/edc-controlplane-base/build.gradle.kts @@ -33,10 +33,12 @@ dependencies { runtimeOnly(libs.edc.core.edrstore) runtimeOnly(libs.edc.edr.store.receiver) runtimeOnly(libs.edc.dpf.transfer.signaling) - + runtimeOnly(libs.edc.controlplane.callback.staticendpoint) // needed for BPN validation runtimeOnly(project(":edc-extensions:bpn-validation")) + // Credentials CX policies + runtimeOnly(project(":edc-extensions:cx-policy")) // needed for IATP integration runtimeOnly(project(":core:json-ld-core")) diff --git a/edc-extensions/bdrs-client/build.gradle.kts b/edc-extensions/bdrs-client/build.gradle.kts index 30e1401e8..87492eb8b 100644 --- a/edc-extensions/bdrs-client/build.gradle.kts +++ b/edc-extensions/bdrs-client/build.gradle.kts @@ -25,8 +25,15 @@ plugins { dependencies { implementation(project(":core:core-utils")) implementation(project(":spi:bdrs-client-spi")) + implementation(project(":spi:core-spi")) + implementation(libs.edc.spi.boot) implementation(libs.edc.spi.core) implementation(libs.edc.spi.http) + implementation(libs.edc.spi.identitytrust) + implementation(libs.edc.spi.identity.did) + implementation(libs.edc.spi.jwt) //JwtRegisteredClaimNames + + implementation(libs.edc.identity.trust.service) testImplementation(libs.netty.mockserver) testImplementation(libs.edc.junit) diff --git a/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientExtension.java b/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientExtension.java index f89cdde5e..94e6ed7b6 100644 --- a/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientExtension.java +++ b/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientExtension.java @@ -20,6 +20,10 @@ package org.eclipse.tractusx.edc.identity.mapper; import org.eclipse.edc.http.spi.EdcHttpClient; +import org.eclipse.edc.iam.did.spi.resolution.DidResolverRegistry; +import org.eclipse.edc.iam.identitytrust.service.DidCredentialServiceUrlResolver; +import org.eclipse.edc.iam.identitytrust.spi.CredentialServiceClient; +import org.eclipse.edc.iam.identitytrust.spi.SecureTokenService; import org.eclipse.edc.runtime.metamodel.annotation.Extension; import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.runtime.metamodel.annotation.Provider; @@ -27,9 +31,11 @@ import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.types.TypeManager; -import org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings; import org.eclipse.tractusx.edc.spi.identity.mapper.BdrsClient; +import java.util.function.Supplier; + +import static org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings.missingMandatoryProperty; import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.NAME; @Extension(value = NAME) @@ -40,14 +46,30 @@ public class BdrsClientExtension implements ServiceExtension { @Setting(value = "Base URL of the BDRS service", required = true) public static final String BDRS_SERVER_URL_PROPERTY = "tx.iam.iatp.bdrs.server.url"; + @Setting(value = "Base URL of the CredentialService, that belongs to this connector runtime. If not specified, the URL is resolved from this participant's DID document.") + public static final String CREDENTIAL_SERVICE_BASE_URL_PROPERTY = "tx.iam.iatp.credentialservice.url"; + @Setting(value = "Validity period in seconds for the cached BPN/DID mappings. After this period a new resolution request will hit the server.", defaultValue = DEFAULT_BDRS_CACHE_VALIDITY + "") public static final String BDRS_SERVER_CACHE_VALIDITY_PERIOD = "tx.iam.iatp.bdrs.cache.validity"; + // this setting is already defined in IdentityAndTrustExtension + public static final String CONNECTOR_DID_PROPERTY = "edc.iam.issuer.id"; + @Inject private EdcHttpClient httpClient; + @Inject private TypeManager typeManager; + @Inject + private SecureTokenService secureTokenService; + + @Inject + private CredentialServiceClient credentialServiceClient; + + @Inject + private DidResolverRegistry didResolverRegistry; + @Override public String name() { return NAME; @@ -56,11 +78,37 @@ public String name() { @Provider public BdrsClient getBdrsClient(ServiceExtensionContext context) { var baseUrl = context.getConfig().getString(BDRS_SERVER_URL_PROPERTY, null); + var monitor = context.getMonitor(); if (baseUrl == null) { - RequiredConfigWarnings.warningNotPresent(context.getMonitor(), BDRS_SERVER_URL_PROPERTY); + missingMandatoryProperty(monitor, BDRS_SERVER_URL_PROPERTY); } var cacheValidity = context.getConfig().getInteger(BDRS_SERVER_CACHE_VALIDITY_PERIOD, DEFAULT_BDRS_CACHE_VALIDITY); - return new BdrsClientImpl(baseUrl, cacheValidity, httpClient, context.getMonitor(), typeManager.getMapper()); + + // get DID + var ownDid = context.getConfig().getString(CONNECTOR_DID_PROPERTY, null); + if (ownDid == null) { + missingMandatoryProperty(monitor, CONNECTOR_DID_PROPERTY); + } + + // get CS URL + Supplier urlSupplier; + var configuredUrl = context.getConfig().getString(CREDENTIAL_SERVICE_BASE_URL_PROPERTY, null); + if (configuredUrl != null) { + urlSupplier = () -> configuredUrl; + } else { + monitor.warning("No config value found for '%s'. As a fallback, the credentialService URL from this connector's DID document will be resolved.".formatted(CREDENTIAL_SERVICE_BASE_URL_PROPERTY)); + + urlSupplier = () -> { + var resolver = new DidCredentialServiceUrlResolver(didResolverRegistry); + return resolver.resolve(ownDid).orElse(f -> { + monitor.severe("Resolving the credentialService URL failed. This runtime won't be able to communicate with BDRS. Error: %s.".formatted(f.getFailureDetail())); + return null; + }); + }; + + } + + return new BdrsClientImpl(baseUrl, cacheValidity, ownDid, urlSupplier, httpClient, monitor, typeManager.getMapper(), secureTokenService, credentialServiceClient); } } diff --git a/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImpl.java b/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImpl.java index e9c5fac5f..859a91fa0 100644 --- a/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImpl.java +++ b/edc-extensions/bdrs-client/src/main/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImpl.java @@ -23,18 +23,30 @@ import com.fasterxml.jackson.databind.ObjectMapper; import okhttp3.Request; import org.eclipse.edc.http.spi.EdcHttpClient; +import org.eclipse.edc.iam.identitytrust.spi.CredentialServiceClient; +import org.eclipse.edc.iam.identitytrust.spi.SecureTokenService; import org.eclipse.edc.spi.EdcException; import org.eclipse.edc.spi.monitor.Monitor; +import org.eclipse.edc.spi.result.Result; +import org.eclipse.tractusx.edc.TxIatpConstants; import org.eclipse.tractusx.edc.spi.identity.mapper.BdrsClient; import java.io.IOException; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.function.Supplier; import java.util.zip.GZIPInputStream; +import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.AUDIENCE; +import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.ISSUER; +import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.JWT_ID; +import static org.eclipse.edc.jwt.spi.JwtRegisteredClaimNames.SUBJECT; + /** * Holds a local cache of BPN-to-DID mapping entries. *

@@ -49,15 +61,31 @@ class BdrsClientImpl implements BdrsClient { private final Monitor monitor; private final ObjectMapper mapper; private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + private final SecureTokenService secureTokenService; + private final String ownDid; + private final Supplier ownCredentialServiceUrl; + private final CredentialServiceClient credentialServiceClient; private Map cache = new HashMap<>(); private Instant lastCacheUpdate; - BdrsClientImpl(String baseUrl, int cacheValidity, EdcHttpClient httpClient, Monitor monitor, ObjectMapper mapper) { + BdrsClientImpl(String baseUrl, + int cacheValidity, + String ownDid, + Supplier ownCredentialServiceUrl, + EdcHttpClient httpClient, + Monitor monitor, + ObjectMapper mapper, + SecureTokenService secureTokenService, + CredentialServiceClient credentialServiceClient) { this.serverUrl = baseUrl; this.cacheValidity = cacheValidity; this.httpClient = httpClient; this.monitor = monitor; this.mapper = mapper; + this.secureTokenService = secureTokenService; + this.ownDid = ownDid; + this.ownCredentialServiceUrl = ownCredentialServiceUrl; + this.credentialServiceClient = credentialServiceClient; } @Override @@ -70,7 +98,7 @@ public String resolve(String bpn) { lock.writeLock().lock(); try { if (isCacheExpired()) { - updateCache(); + updateCache().orElseThrow(f -> new EdcException(f.getFailureDetail())); } } finally { lock.readLock().lock(); // downgrade lock @@ -89,9 +117,14 @@ private boolean isCacheExpired() { return lastCacheUpdate == null || lastCacheUpdate.plus(cacheValidity, ChronoUnit.SECONDS).isBefore(Instant.now()); } - private void updateCache() { + private Result updateCache() { + var membershipCredToken = createMembershipPresentation(); + if (membershipCredToken.failed()) { + return membershipCredToken.mapTo(); + } + var request = new Request.Builder() - //.addHeader("Authorization", createMembershipPresentation()) //todo: add MembershipCredential as JWT-VP to the auth header + .addHeader("Authorization", "Bearer " + membershipCredToken.getContent()) .header("Accept-Encoding", "gzip") .url(serverUrl + "/bpn-directory") .get() @@ -103,15 +136,39 @@ private void updateCache() { var bytes = gz.readAllBytes(); cache = mapper.readValue(bytes, MAP_REF); lastCacheUpdate = Instant.now(); + return Result.success(); } } else { var msg = "Could not obtain data from BDRS server: code: %d, message: %s".formatted(response.code(), response.message()); - throw new EdcException(msg); + return Result.failure(msg); } } catch (IOException e) { - monitor.severe("Error fetching BDRS data", e); - throw new EdcException(e); + var msg = "Error fetching BDRS data"; + monitor.severe(msg, e); + return Result.failure(msg); } } + private Result createMembershipPresentation() { + var claims = Map.of( + JWT_ID, UUID.randomUUID().toString(), + ISSUER, ownDid, + SUBJECT, ownDid, + AUDIENCE, ownDid + ); + var scope = TxIatpConstants.DEFAULT_MEMBERSHIP_SCOPE; + + return secureTokenService.createToken(claims, scope) + .compose(sit -> credentialServiceClient.requestPresentation(ownCredentialServiceUrl.get(), sit.getToken(), List.of(scope))) + .compose(pres -> { + if (pres.isEmpty()) { + return Result.failure("Expected exactly 1 VP, but was empty"); + } + if (pres.size() != 1) { + monitor.warning("Expected exactly 1 VP, but found %d.".formatted(pres.size())); + } + return Result.success(pres.get(0).rawVp()); + }); + } + } diff --git a/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplExtensionTest.java b/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplExtensionTest.java index 8e3b4246a..25bf5c1de 100644 --- a/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplExtensionTest.java +++ b/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplExtensionTest.java @@ -19,29 +19,43 @@ package org.eclipse.tractusx.edc.identity.mapper; +import org.eclipse.edc.iam.did.spi.document.DidDocument; +import org.eclipse.edc.iam.did.spi.document.Service; +import org.eclipse.edc.iam.did.spi.resolution.DidResolverRegistry; import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; import org.eclipse.edc.spi.monitor.Monitor; +import org.eclipse.edc.spi.result.Result; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.configuration.Config; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import java.util.List; + import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.BDRS_SERVER_URL_PROPERTY; +import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.CONNECTOR_DID_PROPERTY; +import static org.eclipse.tractusx.edc.identity.mapper.BdrsClientExtension.CREDENTIAL_SERVICE_BASE_URL_PROPERTY; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.ArgumentMatchers.startsWith; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; @ExtendWith(DependencyInjectionExtension.class) class BdrsClientImplExtensionTest { private final Monitor monitor = mock(); + private final DidResolverRegistry resolverRegistry = mock(); @BeforeEach void setup(ServiceExtensionContext context) { context.registerService(Monitor.class, monitor); + context.registerService(DidResolverRegistry.class, resolverRegistry); } @Test @@ -49,9 +63,58 @@ void createClient_whenUrlMissing_expectLogError(ServiceExtensionContext context, var cfg = mock(Config.class); when(context.getConfig()).thenReturn(cfg); when(cfg.getString(eq(BDRS_SERVER_URL_PROPERTY), isNull())).thenReturn(null); + when(cfg.getString(eq(CONNECTOR_DID_PROPERTY), isNull())).thenReturn("did:web:self"); + when(cfg.getString(eq(CREDENTIAL_SERVICE_BASE_URL_PROPERTY), isNull())).thenReturn("https://credential.service"); extension.getBdrsClient(context); verify(monitor).severe(eq("Mandatory config value missing: 'tx.iam.iatp.bdrs.server.url'. This runtime will not be fully operational! Starting with v0.7.x this will be a runtime error.")); + verifyNoMoreInteractions(monitor); + } + + @Test + void createClient_whenNoCredentialServiceUrl_shouldInvokeResolver(ServiceExtensionContext context, BdrsClientExtension extension) { + var cfg = mock(Config.class); + when(context.getConfig()).thenReturn(cfg); + when(cfg.getString(eq(BDRS_SERVER_URL_PROPERTY), isNull())).thenReturn("https://bdrs.server"); + when(cfg.getString(eq(CREDENTIAL_SERVICE_BASE_URL_PROPERTY), isNull())).thenReturn(null); + when(cfg.getString(eq(CONNECTOR_DID_PROPERTY), isNull())).thenReturn("did:web:self"); + when(resolverRegistry.resolve(anyString())).thenReturn(Result.success(DidDocument.Builder.newInstance().service(List.of(new Service(null, "CredentialService", "http://credential.service"))).build())); + + extension.getBdrsClient(context); + + verify(monitor).warning("No config value found for 'tx.iam.iatp.credentialservice.url'. As a fallback, the credentialService URL from this connector's DID document will be resolved."); + verifyNoMoreInteractions(monitor); + } + + @Test + void createClient_whenResolverFails_expectLogError(ServiceExtensionContext context, BdrsClientExtension extension) { + var cfg = mock(Config.class); + when(context.getConfig()).thenReturn(cfg); + when(cfg.getString(eq(BDRS_SERVER_URL_PROPERTY), isNull())).thenReturn("https://bdrs.server"); + when(cfg.getString(eq(CREDENTIAL_SERVICE_BASE_URL_PROPERTY), isNull())).thenReturn(null); + when(cfg.getString(eq(CONNECTOR_DID_PROPERTY), isNull())).thenReturn("did:web:self"); + when(resolverRegistry.resolve(anyString())).thenReturn(Result.failure("test failure")); + + var client = extension.getBdrsClient(context); + + verify(monitor).warning("No config value found for 'tx.iam.iatp.credentialservice.url'. As a fallback, the credentialService URL from this connector's DID document will be resolved."); + + // the DID url resolver is only invoked on-demand, so no eager-loading of the DID document + verify(monitor, never()).severe("Resolving the credentialService URL failed. This runtime won't be able to communicate with BDRS. Error: test failure."); + verifyNoMoreInteractions(monitor); + } + + @Test + void createClient_whenNoDid_expectLogError(ServiceExtensionContext context, BdrsClientExtension extension) { + var cfg = mock(Config.class); + when(context.getConfig()).thenReturn(cfg); + when(cfg.getString(eq(BDRS_SERVER_URL_PROPERTY), isNull())).thenReturn("https://bdrs.server"); + when(cfg.getString(eq(CREDENTIAL_SERVICE_BASE_URL_PROPERTY), isNull())).thenReturn("https://credential.service"); + when(cfg.getString(eq(CONNECTOR_DID_PROPERTY), isNull())).thenReturn(null); + + extension.getBdrsClient(context); + verify(monitor).severe(startsWith("Mandatory config value missing: 'edc.iam.issuer.id'. This runtime will not be fully operational!")); + verifyNoMoreInteractions(monitor); } } \ No newline at end of file diff --git a/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplTest.java b/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplTest.java index 4cb5f3c0d..bf1d512f6 100644 --- a/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplTest.java +++ b/edc-extensions/bdrs-client/src/test/java/org/eclipse/tractusx/edc/identity/mapper/BdrsClientImplTest.java @@ -23,8 +23,15 @@ import dev.failsafe.RetryPolicy; import okhttp3.OkHttpClient; import org.eclipse.edc.http.client.EdcHttpClientImpl; +import org.eclipse.edc.iam.identitytrust.spi.CredentialServiceClient; +import org.eclipse.edc.iam.identitytrust.spi.SecureTokenService; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialFormat; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.VerifiablePresentation; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.VerifiablePresentationContainer; import org.eclipse.edc.spi.EdcException; +import org.eclipse.edc.spi.iam.TokenRepresentation; import org.eclipse.edc.spi.monitor.Monitor; +import org.eclipse.edc.spi.result.Result; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -35,22 +42,35 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.zip.GZIPOutputStream; import static java.time.Duration.ofSeconds; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatNoException; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.awaitility.Awaitility.await; import static org.eclipse.edc.util.io.Ports.getFreePort; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.notNull; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import static org.mockserver.model.HttpRequest.request; import static org.mockserver.verify.VerificationTimes.exactly; +import static org.mockserver.verify.VerificationTimes.never; class BdrsClientImplTest { + public static final String TEST_VP_CONTENT = "test-raw-vp"; private final Monitor monitor = mock(); private final ObjectMapper mapper = new ObjectMapper(); + private final SecureTokenService stsMock = mock(); + private final CredentialServiceClient csMock = mock(); private BdrsClientImpl client; private ClientAndServer bdrsServer; @@ -65,7 +85,20 @@ void setup() { .withBody(createGzipStream()) .withStatusCode(200)); - client = new BdrsClientImpl("http://localhost:%d/api".formatted(bdrsServer.getPort()), 1, new EdcHttpClientImpl(new OkHttpClient(), RetryPolicy.ofDefaults(), monitor), monitor, mapper); + client = new BdrsClientImpl("http://localhost:%d/api".formatted(bdrsServer.getPort()), 1, + "did:web:self", + () -> "http://credential.service", + new EdcHttpClientImpl(new OkHttpClient(), RetryPolicy.ofDefaults(), monitor), + monitor, + mapper, + stsMock, + csMock); + + // prime STS and CS + when(stsMock.createToken(anyMap(), notNull())).thenReturn(Result.success(TokenRepresentation.Builder.newInstance().token("my-fancy-sitoken").build())); + when(csMock.requestPresentation(anyString(), anyString(), anyList())) + .thenReturn(Result.success(List.of(new VerifiablePresentationContainer(TEST_VP_CONTENT, CredentialFormat.JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build())))); + } @AfterEach @@ -78,11 +111,7 @@ void getData_whenCacheCold_shouldHitServer() { var did = client.resolve("bpn1"); assertThat(did).isEqualTo("did:web:did1"); - bdrsServer.verify(request() - .withMethod("GET") - .withPath("/api/bpn-directory") - .withHeader("Accept-Encoding", "gzip"), - exactly(1)); + verifyBdrsRequest(1); } @Test @@ -92,11 +121,7 @@ void getData_whenCacheHot_shouldNotHitServer() { assertThat(did1).isEqualTo("did:web:did1"); assertThat(did2).isEqualTo("did:web:did2"); - bdrsServer.verify(request() - .withMethod("GET") - .withPath("/api/bpn-directory") - .withHeader("Accept-Encoding", "gzip"), - exactly(1)); + verifyBdrsRequest(1); } @Test @@ -110,11 +135,7 @@ void getData_whenCacheExpired_shouldHitServer() { var did2 = client.resolve("bpn2"); // hits server as well, b/c cache is expired assertThat(did2).isEqualTo("did:web:did2"); - bdrsServer.verify(request() - .withHeader("Accept-Encoding", "gzip") - .withMethod("GET") - .withPath("/api/bpn-directory"), - exactly(2)); + verifyBdrsRequest(2); }); } @@ -123,11 +144,7 @@ void getData_whenCacheExpired_shouldHitServer() { void getData_whenNotFound() { var did = client.resolve("bpn-notexist"); assertThat(did).isNull(); - bdrsServer.verify(request() - .withMethod("GET") - .withPath("/api/bpn-directory") - .withHeader("Accept-Encoding", "gzip"), - exactly(1)); + verifyBdrsRequest(1); } @ParameterizedTest(name = "HTTP Status {0}") @@ -139,6 +156,58 @@ void getData_bdrsReturnsError(int code) { assertThatThrownBy(() -> client.resolve("bpn1")).isInstanceOf(EdcException.class); } + @Test + void getData_whenStsFails() { + when(stsMock.createToken(anyMap(), notNull())).thenReturn(Result.failure("test-failure")); + assertThatThrownBy(() -> client.resolve("bpn1")) + .isInstanceOf(EdcException.class) + .hasMessage("test-failure"); + bdrsServer.verify(request(), never()); + } + + @Test + void getData_whenPresentationQueryFails() { + when(csMock.requestPresentation(anyString(), anyString(), anyList())).thenReturn(Result.failure("test-failure")); + + assertThatThrownBy(() -> client.resolve("bpn1")) + .isInstanceOf(EdcException.class) + .hasMessage("test-failure"); + bdrsServer.verify(request(), never()); + } + + @Test + void getData_whenPresentationQueryReturnsTooManyVps() { + var presentations = List.of( + new VerifiablePresentationContainer(TEST_VP_CONTENT, CredentialFormat.JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build()), + new VerifiablePresentationContainer("test-raw-vp-2", CredentialFormat.JWT, VerifiablePresentation.Builder.newInstance().type("VerifiableCredential").build())); + + when(csMock.requestPresentation(anyString(), anyString(), anyList())).thenReturn(Result.success(presentations)); + + assertThatNoException().isThrownBy(() -> client.resolve("bpn1")); + verifyBdrsRequest(1); + verify(monitor).warning("Expected exactly 1 VP, but found 2."); + } + + @Test + void getData_whenPresentationQueryReturnsEmpty() { + + when(csMock.requestPresentation(anyString(), anyString(), anyList())).thenReturn(Result.success(Collections.emptyList())); + + assertThatThrownBy(() -> client.resolve("bpn1")) + .isInstanceOf(EdcException.class) + .hasMessage("Expected exactly 1 VP, but was empty"); + bdrsServer.verify(request(), never()); + } + + private void verifyBdrsRequest(int count) { + bdrsServer.verify(request() + .withMethod("GET") + .withPath("/api/bpn-directory") + .withHeader("Authorization", "Bearer " + TEST_VP_CONTENT) + .withHeader("Accept-Encoding", "gzip"), + exactly(count)); + } + private byte[] createGzipStream() { var data = Map.of("bpn1", "did:web:did1", "bpn2", "did:web:did2", diff --git a/edc-extensions/bpn-validation/business-partner-store-sql/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/store/sql/SqlBusinessPartnerStoreTest.java b/edc-extensions/bpn-validation/business-partner-store-sql/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/store/sql/SqlBusinessPartnerStoreTest.java index cd3e83c1d..66a1fa591 100644 --- a/edc-extensions/bpn-validation/business-partner-store-sql/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/store/sql/SqlBusinessPartnerStoreTest.java +++ b/edc-extensions/bpn-validation/business-partner-store-sql/src/test/java/org/eclipse/tractusx/edc/validation/businesspartner/store/sql/SqlBusinessPartnerStoreTest.java @@ -19,6 +19,7 @@ package org.eclipse.tractusx.edc.validation.businesspartner.store.sql; +import org.eclipse.edc.json.JacksonTypeManager; import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest; import org.eclipse.edc.spi.types.TypeManager; import org.eclipse.edc.sql.QueryExecutor; @@ -36,7 +37,7 @@ @PostgresqlIntegrationTest @ExtendWith(PostgresqlStoreSetupExtension.class) class SqlBusinessPartnerStoreTest extends BusinessPartnerStoreTestBase { - private final TypeManager typeManager = new TypeManager(); + private final TypeManager typeManager = new JacksonTypeManager(); private final BusinessPartnerGroupStatements statements = new PostgresBusinessPartnerGroupStatements(); private SqlBusinessPartnerStore store; diff --git a/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/common/AbstractDynamicCredentialConstraintFunction.java b/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/common/AbstractDynamicCredentialConstraintFunction.java index 91d08d29c..1648cee3f 100644 --- a/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/common/AbstractDynamicCredentialConstraintFunction.java +++ b/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/common/AbstractDynamicCredentialConstraintFunction.java @@ -19,6 +19,7 @@ package org.eclipse.tractusx.edc.policy.cx.common; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialSubject; import org.eclipse.edc.iam.verifiablecredentials.spi.model.VerifiableCredential; import org.eclipse.edc.policy.engine.spi.DynamicAtomicConstraintFunction; import org.eclipse.edc.policy.engine.spi.PolicyContext; @@ -29,6 +30,7 @@ import java.util.Collection; import java.util.List; +import java.util.Optional; /** * This is a base class for dynamically bound Tractus-X constraint evaluation functions that implements some basic common functionality and defines some @@ -77,4 +79,9 @@ protected Result> getCredentialList(ParticipantAgent return Result.success(vcList); } + protected Object getClaimOrDefault(CredentialSubject subject, String namespace, String property, Object def) { + return Optional.ofNullable(subject.getClaims().get(namespace + property)) + .or(() -> Optional.ofNullable(subject.getClaims().get(property))) + .orElse(def); + } } diff --git a/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerCredentialConstraintFunction.java b/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerCredentialConstraintFunction.java index 12c319854..02c8be79a 100644 --- a/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerCredentialConstraintFunction.java +++ b/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerCredentialConstraintFunction.java @@ -51,11 +51,11 @@ */ public class DismantlerCredentialConstraintFunction extends AbstractDynamicCredentialConstraintFunction { - public static final String ALLOWED_VEHICLE_BRANDS = CX_CREDENTIAL_NS + "allowedVehicleBrands"; + public static final String ALLOWED_VEHICLE_BRANDS_LITERAL = "allowedVehicleBrands"; public static final String DISMANTLER_LITERAL = "Dismantler"; // allows to encode multiple values in a single string in the right-operand. Policies don't handle list-type right-operands well. public static final String RIGHT_OPERAND_LIST_SEPARATOR = ","; - private static final String ALLOWED_ACTIVITIES = CX_CREDENTIAL_NS + "activityType"; + private static final String ALLOWED_ACTIVITIES_LITERAL = "activityType"; @Override public boolean evaluate(Object leftOperand, Operator operator, Object rightOperand, Permission permission, PolicyContext context) { @@ -97,10 +97,10 @@ public boolean evaluate(Object leftOperand, Operator operator, Object rightOpera } else if (leftOperand.equals(CX_POLICY_NS + DISMANTLER_LITERAL + ".activityType")) { if (hasInvalidOperand(operator, rightOperand, context)) return false; - predicate = predicate.and(getCredentialPredicate(ALLOWED_ACTIVITIES, operator, rightOperand)); + predicate = predicate.and(getCredentialPredicate(ALLOWED_ACTIVITIES_LITERAL, operator, rightOperand)); } else if (leftOperand.equals(CX_POLICY_NS + DISMANTLER_LITERAL + ".allowedBrands")) { if (hasInvalidOperand(operator, rightOperand, context)) return false; - predicate = predicate.and(getCredentialPredicate(ALLOWED_VEHICLE_BRANDS, operator, rightOperand)); + predicate = predicate.and(getCredentialPredicate(ALLOWED_VEHICLE_BRANDS_LITERAL, operator, rightOperand)); } else { context.reportProblem("Invalid left-operand: must be 'Dismantler[.activityType | .allowedBrands ], but was '%s'".formatted(leftOperand)); return false; @@ -129,7 +129,7 @@ private Predicate getCredentialPredicate(String credential var allowedValues = getList(rightOperand); // the filter predicate is determined by the operator return credential -> credential.getCredentialSubject().stream().anyMatch(subject -> { - var claimsFromCredential = getList(subject.getClaims().getOrDefault(credentialSubjectProperty, List.of())); + var claimsFromCredential = getList(getClaimOrDefault(subject, CX_CREDENTIAL_NS, credentialSubjectProperty, List.of())); return switch (operator) { case EQ -> claimsFromCredential.equals(allowedValues); case NEQ -> !claimsFromCredential.equals(allowedValues); diff --git a/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementCredentialConstraintFunction.java b/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementCredentialConstraintFunction.java index 253e01b2c..eb12ee221 100644 --- a/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementCredentialConstraintFunction.java +++ b/edc-extensions/cx-policy/src/main/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementCredentialConstraintFunction.java @@ -54,7 +54,7 @@ * credential that satisfies the {@code subtype} requirement. */ public class FrameworkAgreementCredentialConstraintFunction extends AbstractDynamicCredentialConstraintFunction { - public static final String CONTRACT_VERSION_PROPERTY = CX_CREDENTIAL_NS + "contractVersion"; + public static final String CONTRACT_VERSION_LITERAL = "contractVersion"; public static final String FRAMEWORK_AGREEMENT_LITERAL = "FrameworkAgreement"; /** @@ -176,7 +176,7 @@ private List> createPredicates(String subtype, @ list.add(new CredentialTypePredicate(CX_CREDENTIAL_NS, capitalize(subtype) + CREDENTIAL_LITERAL)); if (version != null) { - list.add(credential -> credential.getCredentialSubject().stream().anyMatch(cs -> version.equals(cs.getClaims().getOrDefault(CONTRACT_VERSION_PROPERTY, null)))); + list.add(credential -> credential.getCredentialSubject().stream().anyMatch(cs -> version.equals(getClaimOrDefault(cs, CX_CREDENTIAL_NS, CONTRACT_VERSION_LITERAL, null)))); } return list; } diff --git a/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/CredentialFunctions.java b/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/CredentialFunctions.java index 1aedea42d..2a3256ce5 100644 --- a/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/CredentialFunctions.java +++ b/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/CredentialFunctions.java @@ -51,14 +51,53 @@ public static VerifiableCredential.Builder createCredential(String type, String .build()); } + public static VerifiableCredential.Builder createPlainFrameworkCredential(String type, String version) { + return VerifiableCredential.Builder.newInstance() + .types(List.of("VerifiableCredential", type)) + .id(UUID.randomUUID().toString()) + .issuer(new Issuer(UUID.randomUUID().toString(), Map.of("prop1", "val1"))) + .expirationDate(Instant.now().plus(365, ChronoUnit.DAYS)) + .issuanceDate(Instant.now()) + .credentialSubject(CredentialSubject.Builder.newInstance() + .id("subject-id") + .claim("holderIdentifier", "did:web:holder") + .claim("contractVersion", version) + .claim("contractTemplate", "https://public.catena-x.org/contracts/pcf.v1.pdf") + .build()); + } + public static VerifiableCredential.Builder createPcfCredential() { return createCredential("PcfCredential", "1.0.0"); } + public static VerifiableCredential.Builder createPlainPcfCredential() { + return createPlainFrameworkCredential("PcfCredential", "1.0.0"); + } + public static VerifiableCredential.Builder createDismantlerCredential(String... brands) { return createDismantlerCredential(Arrays.asList(brands), "vehicleDismantle"); } + public static VerifiableCredential.Builder createPlainDismantlerCredential(String... brands) { + return createPlainDismantlerCredential(Arrays.asList(brands), "vehicleDismantle"); + } + + public static VerifiableCredential.Builder createPlainDismantlerCredential(Collection brands, String... activityType) { + var at = activityType.length == 1 ? activityType[0] : List.of(activityType); + return VerifiableCredential.Builder.newInstance() + .types(List.of("VerifiableCredential", "DismantlerCredential")) + .id(UUID.randomUUID().toString()) + .issuer(new Issuer(UUID.randomUUID().toString(), Map.of("prop1", "val1"))) + .expirationDate(Instant.now().plus(365, ChronoUnit.DAYS)) + .issuanceDate(Instant.now()) + .credentialSubject(CredentialSubject.Builder.newInstance() + .id("subject-id") + .claim("holderIdentifier", "did:web:holder") + .claim("allowedVehicleBrands", brands) + .claim("activityType", at) + .build()); + } + public static VerifiableCredential.Builder createDismantlerCredential(Collection brands, String... activityType) { var at = activityType.length == 1 ? activityType[0] : List.of(activityType); return VerifiableCredential.Builder.newInstance() diff --git a/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerConstraintFunctionTest.java b/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerConstraintFunctionTest.java index 2dfce69fa..f5b68805c 100644 --- a/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerConstraintFunctionTest.java +++ b/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/dismantler/DismantlerConstraintFunctionTest.java @@ -38,6 +38,7 @@ import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.CX_POLICY_NS; import static org.eclipse.tractusx.edc.policy.cx.CredentialFunctions.createDismantlerCredential; import static org.eclipse.tractusx.edc.policy.cx.CredentialFunctions.createPcfCredential; +import static org.eclipse.tractusx.edc.policy.cx.CredentialFunctions.createPlainDismantlerCredential; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.startsWith; @@ -101,6 +102,12 @@ void evaluate_eq_satisfied() { assertThat(function.evaluate(CX_POLICY_NS + "Dismantler", Operator.EQ, "active", null, context)).isTrue(); } + @Test + void evaluate_eq_withoutNamespace() { + when(participantAgent.getClaims()).thenReturn(Map.of("vc", List.of(createDismantlerCredential("Tatra", "Moskvich").build()))); + assertThat(function.evaluate(CX_POLICY_NS + "Dismantler", Operator.EQ, "active", null, context)).isTrue(); + } + @Test void evaluate_eq_notSatisfied() { when(participantAgent.getClaims()).thenReturn(Map.of("vc", List.of(createPcfCredential().build()))); @@ -148,6 +155,13 @@ void evaluate_eq_list() { assertThat(function.evaluate(CX_POLICY_NS + "Dismantler.allowedBrands", Operator.EQ, List.of("Tatra", "Moskvich"), null, context)).isTrue(); } + @DisplayName("Constraint (list) must match credential EXACTLY") + @Test + void evaluate_eq_list_withoutNamespace() { + when(participantAgent.getClaims()).thenReturn(Map.of("vc", List.of(createPlainDismantlerCredential("Tatra", "Moskvich").build()))); + assertThat(function.evaluate(CX_POLICY_NS + "Dismantler.allowedBrands", Operator.EQ, List.of("Tatra", "Moskvich"), null, context)).isTrue(); + } + @DisplayName("Constraint (list) must credential EXACTLY - failure") @Test void evaluate_eq_list_notSatisfied() { @@ -299,6 +313,13 @@ void evaluate_eq_list() { assertThat(function.evaluate(CX_POLICY_NS + "Dismantler.activityType", Operator.EQ, List.of("vehicleDismantle", "vehicleScrap"), null, context)).isTrue(); } + @DisplayName("Constraint (list) must match credential EXACTLY") + @Test + void evaluate_eq_list_withoutNamespace() { + when(participantAgent.getClaims()).thenReturn(Map.of("vc", List.of(createPlainDismantlerCredential(brands, "vehicleDismantle", "vehicleScrap").build()))); + assertThat(function.evaluate(CX_POLICY_NS + "Dismantler.activityType", Operator.EQ, List.of("vehicleDismantle", "vehicleScrap"), null, context)).isTrue(); + } + @DisplayName("Constraint (list) must credential EXACTLY - failure") @Test void evaluate_eq_list_notSatisfied() { diff --git a/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementConstraintFunctionTest.java b/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementConstraintFunctionTest.java index 56ef833f1..dad68ccc4 100644 --- a/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementConstraintFunctionTest.java +++ b/edc-extensions/cx-policy/src/test/java/org/eclipse/tractusx/edc/policy/cx/framework/FrameworkAgreementConstraintFunctionTest.java @@ -36,6 +36,7 @@ import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.CX_POLICY_NS; import static org.eclipse.tractusx.edc.policy.cx.CredentialFunctions.createCredential; import static org.eclipse.tractusx.edc.policy.cx.CredentialFunctions.createPcfCredential; +import static org.eclipse.tractusx.edc.policy.cx.CredentialFunctions.createPlainPcfCredential; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.startsWith; import static org.mockito.Mockito.mock; @@ -284,6 +285,15 @@ void evaluate_rightOperand_withVersion() { assertThat(function.evaluate(CX_POLICY_NS + "FrameworkAgreement", Operator.EQ, "pcf:4.2.0", permission, context)).isFalse(); } + @Test + void evaluate_withoutNamespace() { + when(participantAgent.getClaims()).thenReturn(Map.of( + "vc", List.of(createPlainPcfCredential().build()) + )); + assertThat(function.evaluate(CX_POLICY_NS + "FrameworkAgreement", Operator.EQ, "pcf:1.0.0", permission, context)).isTrue(); + assertThat(function.evaluate(CX_POLICY_NS + "FrameworkAgreement", Operator.EQ, "pcf:4.2.0", permission, context)).isFalse(); + } + @Test void evaluate_rightOperandMissesSubtype() { when(participantAgent.getClaims()).thenReturn(Map.of( diff --git a/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/ConsumerAssetRequestController.java b/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/ConsumerAssetRequestController.java index b2aa6c08e..9663b6da1 100644 --- a/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/ConsumerAssetRequestController.java +++ b/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/main/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/ConsumerAssetRequestController.java @@ -78,7 +78,7 @@ public class ConsumerAssetRequestController implements ConsumerAssetRequestApi { private final Map> mappers = Map.of( - "provider", AssetRequest::getProviderId, + "providerId", AssetRequest::getProviderId, "transferProcessId", AssetRequest::getTransferProcessId, "assetId", AssetRequest::getAssetId); diff --git a/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/test/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/model/ConsumerAssetRequestControllerTest.java b/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/test/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/model/ConsumerAssetRequestControllerTest.java index 9a383d5aa..43e74377f 100644 --- a/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/test/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/model/ConsumerAssetRequestControllerTest.java +++ b/edc-extensions/dataplane/dataplane-proxy/edc-dataplane-proxy-consumer-api/src/test/java/org/eclipse/tractusx/edc/dataplane/proxy/consumer/api/asset/model/ConsumerAssetRequestControllerTest.java @@ -29,6 +29,7 @@ import org.eclipse.edc.edr.spi.types.EndpointDataReferenceEntry; import org.eclipse.edc.junit.annotations.ApiTest; import org.eclipse.edc.spi.monitor.Monitor; +import org.eclipse.edc.spi.query.QuerySpec; import org.eclipse.edc.spi.result.ServiceResult; import org.eclipse.edc.spi.types.domain.DataAddress; import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; @@ -41,9 +42,11 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatcher; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.UUID; @@ -62,6 +65,7 @@ import static org.eclipse.tractusx.edc.edr.spi.types.RefreshMode.AUTO_REFRESH; import static org.hamcrest.Matchers.notNullValue; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -97,7 +101,43 @@ void requestAsset_shouldReturnData_withAssetId() throws IOException { when(datasource.openPartStream()).thenReturn(StreamResult.success(Stream.of(partStream))); when(partStream.openStream()).thenReturn(new ByteArrayInputStream(responseBytes)); - when(edrService.query(any())).thenReturn(ServiceResult.success(List.of(edrEntry(assetId, transferProcessId)))); + when(edrService.query(argThat(queryContainsFilter("assetId")))).thenReturn(ServiceResult.success(List.of(edrEntry(assetId, transferProcessId)))); + when(edrService.resolveByTransferProcess(transferProcessId, AUTO_REFRESH)).thenReturn(ServiceResult.success(edr())); + when(pipelineService.transfer(any(), any())) + .thenAnswer(a -> CompletableFuture.completedFuture(StreamResult.success(response))); + + var proxyResponseBytes = baseRequest() + .contentType(MediaType.APPLICATION_JSON) + .body(request) + .post(ASSET_REQUEST_PATH) + .then() + .statusCode(200) + .extract().body().asByteArray(); + + var proxyResponse = mapper.readValue(proxyResponseBytes, new TypeReference>() { + }); + + assertThat(proxyResponse).containsAllEntriesOf(response); + } + + @Test + void requestAsset_shouldReturnData_withAssetIdAndProviderId() throws IOException { + + var assetId = "assetId"; + var transferProcessId = "tp"; + var providerId = "providerId"; + var request = Map.of("assetId", assetId, "providerId", providerId); + + var response = Map.of("response", "ok"); + var responseBytes = mapper.writeValueAsBytes(response); + + var datasource = mock(DataSource.class); + var partStream = mock(DataSource.Part.class); + + when(datasource.openPartStream()).thenReturn(StreamResult.success(Stream.of(partStream))); + when(partStream.openStream()).thenReturn(new ByteArrayInputStream(responseBytes)); + + when(edrService.query(argThat(queryContainsFilter("assetId", "providerId")))).thenReturn(ServiceResult.success(List.of(edrEntry(assetId, transferProcessId, providerId)))); when(edrService.resolveByTransferProcess(transferProcessId, AUTO_REFRESH)).thenReturn(ServiceResult.success(edr())); when(pipelineService.transfer(any(), any())) .thenAnswer(a -> CompletableFuture.completedFuture(StreamResult.success(response))); @@ -283,6 +323,10 @@ protected Object additionalResource() { return new ClientErrorExceptionMapper(); } + private ArgumentMatcher queryContainsFilter(String... fields) { + return (querySpec -> Arrays.stream(fields).allMatch(querySpec::containsAnyLeftOperand)); + } + private DataAddress edr() { return edr(null); } @@ -296,16 +340,20 @@ private EndpointDataReferenceEntry edrEntry(String assetId) { return edrEntry(assetId, UUID.randomUUID().toString()); } - private EndpointDataReferenceEntry edrEntry(String assetId, String transferProcessId) { + private EndpointDataReferenceEntry edrEntry(String assetId, String transferProcessId, String providerId) { return EndpointDataReferenceEntry.Builder.newInstance() .assetId(assetId) .transferProcessId(transferProcessId) .contractNegotiationId(UUID.randomUUID().toString()) .agreementId(UUID.randomUUID().toString()) - .providerId(UUID.randomUUID().toString()) + .providerId(providerId) .build(); } + private EndpointDataReferenceEntry edrEntry(String assetId, String transferProcessId) { + return edrEntry(assetId, transferProcessId, UUID.randomUUID().toString()); + } + private RequestSpecification baseRequest() { return given() .baseUri("http://localhost:" + port) diff --git a/edc-extensions/dataplane/dataplane-token-refresh/token-refresh-core/src/main/java/org/eclipse/tractusx/edc/dataplane/tokenrefresh/core/DataPlaneTokenRefreshServiceExtension.java b/edc-extensions/dataplane/dataplane-token-refresh/token-refresh-core/src/main/java/org/eclipse/tractusx/edc/dataplane/tokenrefresh/core/DataPlaneTokenRefreshServiceExtension.java index 75c5d8b5e..1a202356f 100644 --- a/edc-extensions/dataplane/dataplane-token-refresh/token-refresh-core/src/main/java/org/eclipse/tractusx/edc/dataplane/tokenrefresh/core/DataPlaneTokenRefreshServiceExtension.java +++ b/edc-extensions/dataplane/dataplane-token-refresh/token-refresh-core/src/main/java/org/eclipse/tractusx/edc/dataplane/tokenrefresh/core/DataPlaneTokenRefreshServiceExtension.java @@ -36,7 +36,6 @@ import org.eclipse.edc.spi.types.TypeManager; import org.eclipse.edc.token.JwtGenerationService; import org.eclipse.edc.token.spi.TokenValidationService; -import org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings; import org.eclipse.tractusx.edc.spi.tokenrefresh.dataplane.DataPlaneTokenRefreshService; import org.jetbrains.annotations.NotNull; @@ -44,6 +43,7 @@ import java.time.Clock; import java.util.function.Supplier; +import static org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings.missingMandatoryProperty; import static org.eclipse.tractusx.edc.dataplane.tokenrefresh.core.DataPlaneTokenRefreshServiceExtension.NAME; @Extension(value = NAME) @@ -141,7 +141,7 @@ private String getRefreshEndpointConfig(ServiceExtensionContext context, Monitor private String getOwnDid(ServiceExtensionContext context) { var did = context.getConfig().getString(PARTICIPANT_DID_PROPERTY, null); if (did == null) { - RequiredConfigWarnings.warningNotPresent(context.getMonitor().withPrefix("DataPlane Token Refresh"), PARTICIPANT_DID_PROPERTY); + missingMandatoryProperty(context.getMonitor().withPrefix("DataPlane Token Refresh"), PARTICIPANT_DID_PROPERTY); } return did; } diff --git a/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimSecureTokenServiceExtension.java b/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimSecureTokenServiceExtension.java index 5b01ff4e6..6f8eac970 100644 --- a/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimSecureTokenServiceExtension.java +++ b/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimSecureTokenServiceExtension.java @@ -33,7 +33,7 @@ import org.eclipse.tractusx.edc.iam.iatp.sts.dim.oauth.DimOauth2Client; import static java.util.Optional.ofNullable; -import static org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings.warningNotPresent; +import static org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings.missingMandatoryProperty; @Extension(DimSecureTokenServiceExtension.NAME) public class DimSecureTokenServiceExtension implements ServiceExtension { @@ -70,7 +70,7 @@ public SecureTokenService secureTokenService(ServiceExtensionContext context) { .orElse(null); if (dimUrl == null) { - warningNotPresent(context.getMonitor().withPrefix("STS Client for DIM"), DIM_URL); + missingMandatoryProperty(context.getMonitor().withPrefix("STS Client for DIM"), DIM_URL); } return new DimSecureTokenService(httpClient, dimUrl, dimOauth2Client, typeManager.getMapper(), monitor); diff --git a/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimStsConfigurationExtension.java b/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimStsConfigurationExtension.java index 4f5674955..b3dc2a6a6 100644 --- a/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimStsConfigurationExtension.java +++ b/edc-extensions/iatp/tx-iatp-sts-dim/src/main/java/org/eclipse/tractusx/edc/iam/iatp/sts/dim/DimStsConfigurationExtension.java @@ -27,7 +27,7 @@ import org.eclipse.tractusx.edc.core.utils.PathUtils; import static java.util.Optional.ofNullable; -import static org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings.warningNotPresent; +import static org.eclipse.tractusx.edc.core.utils.RequiredConfigWarnings.missingMandatoryProperty; /** * Configuration Extension for the STS OAuth2 client @@ -62,13 +62,13 @@ public StsRemoteClientConfiguration clientConfiguration(ServiceExtensionContext var monitor = context.getMonitor().withPrefix("STS Client for DIM"); if (tokenUrl == null) { - warningNotPresent(monitor, TOKEN_URL); + missingMandatoryProperty(monitor, TOKEN_URL); } if (clientId == null) { - warningNotPresent(monitor, CLIENT_ID); + missingMandatoryProperty(monitor, CLIENT_ID); } if (clientSecretAlias == null) { - warningNotPresent(monitor, CLIENT_SECRET_ALIAS); + missingMandatoryProperty(monitor, CLIENT_SECRET_ALIAS); } return new StsRemoteClientConfiguration(tokenUrl, clientId, clientSecretAlias); diff --git a/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtension.java b/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtension.java index 5f48e5226..a4310231f 100644 --- a/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtension.java +++ b/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtension.java @@ -33,8 +33,8 @@ import java.util.stream.Collectors; import static java.lang.String.format; +import static org.eclipse.tractusx.edc.TxIatpConstants.DEFAULT_SCOPES; import static org.eclipse.tractusx.edc.iam.iatp.IatpDefaultScopeExtension.NAME; -import static org.eclipse.tractusx.edc.iam.iatp.TxIatpConstants.DEFAULT_SCOPES; @Extension(NAME) public class IatpDefaultScopeExtension implements ServiceExtension { diff --git a/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractor.java b/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractor.java index 8721e4616..1504f4b9f 100644 --- a/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractor.java +++ b/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractor.java @@ -32,8 +32,8 @@ import java.util.Optional; import java.util.Set; +import static org.eclipse.tractusx.edc.TxIatpConstants.CREDENTIAL_TYPE_NAMESPACE; import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.CX_POLICY_NS; -import static org.eclipse.tractusx.edc.iam.iatp.TxIatpConstants.CREDENTIAL_TYPE_NAMESPACE; /** * Extract credentials from the policy constraints @@ -108,6 +108,6 @@ private String extractCredentialType(String leftOperand, Object rightValue) { } private String capitalize(String input) { - return input.substring(0, 1).toUpperCase() + input.substring(1).toLowerCase(); + return input.substring(0, 1).toUpperCase() + input.substring(1); } } diff --git a/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtensionTest.java b/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtensionTest.java index 70cb93136..71e430e51 100644 --- a/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtensionTest.java +++ b/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/IatpDefaultScopeExtensionTest.java @@ -34,11 +34,11 @@ import java.util.Set; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.eclipse.tractusx.edc.TxIatpConstants.DEFAULT_SCOPES; import static org.eclipse.tractusx.edc.iam.iatp.IatpDefaultScopeExtension.CATALOG_REQUEST_SCOPE; import static org.eclipse.tractusx.edc.iam.iatp.IatpDefaultScopeExtension.NEGOTIATION_REQUEST_SCOPE; import static org.eclipse.tractusx.edc.iam.iatp.IatpDefaultScopeExtension.TRANSFER_PROCESS_REQUEST_SCOPE; import static org.eclipse.tractusx.edc.iam.iatp.IatpDefaultScopeExtension.TX_IATP_DEFAULT_SCOPE_PREFIX; -import static org.eclipse.tractusx.edc.iam.iatp.TxIatpConstants.DEFAULT_SCOPES; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; diff --git a/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractorTest.java b/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractorTest.java index a89878479..b7ea750b7 100644 --- a/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractorTest.java +++ b/edc-extensions/iatp/tx-iatp/src/test/java/org/eclipse/tractusx/edc/iam/iatp/scope/CredentialScopeExtractorTest.java @@ -45,7 +45,7 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.tractusx.edc.iam.iatp.TxIatpConstants.CREDENTIAL_TYPE_NAMESPACE; +import static org.eclipse.tractusx.edc.TxIatpConstants.CREDENTIAL_TYPE_NAMESPACE; import static org.eclipse.tractusx.edc.iam.iatp.scope.CredentialScopeExtractor.FRAMEWORK_CREDENTIAL_PREFIX; import static org.mockito.Mockito.mock; diff --git a/edc-extensions/migrations/control-plane-migration/src/test/java/org/eclipse/tractusx/edc/postgresql/migration/AssetPostgresqlMigrationExtensionTest.java b/edc-extensions/migrations/control-plane-migration/src/test/java/org/eclipse/tractusx/edc/postgresql/migration/AssetPostgresqlMigrationExtensionTest.java index 2d18a999e..6a21ae645 100644 --- a/edc-extensions/migrations/control-plane-migration/src/test/java/org/eclipse/tractusx/edc/postgresql/migration/AssetPostgresqlMigrationExtensionTest.java +++ b/edc-extensions/migrations/control-plane-migration/src/test/java/org/eclipse/tractusx/edc/postgresql/migration/AssetPostgresqlMigrationExtensionTest.java @@ -22,8 +22,8 @@ import org.eclipse.edc.connector.controlplane.asset.spi.domain.Asset; import org.eclipse.edc.connector.controlplane.store.sql.assetindex.SqlAssetIndex; import org.eclipse.edc.connector.controlplane.store.sql.assetindex.schema.postgres.PostgresDialectStatements; +import org.eclipse.edc.json.JacksonTypeManager; import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest; -import org.eclipse.edc.spi.types.TypeManager; import org.eclipse.edc.sql.QueryExecutor; import org.eclipse.edc.sql.testfixtures.PostgresqlStoreSetupExtension; import org.flywaydb.core.api.MigrationVersion; @@ -44,7 +44,7 @@ class AssetPostgresqlMigrationExtensionTest { @BeforeEach void setUp(PostgresqlStoreSetupExtension extension, QueryExecutor queryExecutor) { store = new SqlAssetIndex(extension.getDataSourceRegistry(), extension.getDatasourceName(), - extension.getTransactionContext(), new TypeManager().getMapper(), new PostgresDialectStatements(), + extension.getTransactionContext(), new JacksonTypeManager().getMapper(), new PostgresDialectStatements(), queryExecutor); } diff --git a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersProvisionedResourceTest.java b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersProvisionedResourceTest.java index c04d3374a..9272f7e73 100644 --- a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersProvisionedResourceTest.java +++ b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersProvisionedResourceTest.java @@ -20,7 +20,7 @@ package org.eclipse.tractusx.edc.provision.additionalheaders; -import org.eclipse.edc.spi.types.TypeManager; +import org.eclipse.edc.json.JacksonTypeManager; import org.eclipse.edc.spi.types.domain.DataAddress; import org.junit.jupiter.api.Test; @@ -32,7 +32,7 @@ class AdditionalHeadersProvisionedResourceTest { @Test void serdes() { - var typeManager = new TypeManager(); + var typeManager = new JacksonTypeManager(); var resource = AdditionalHeadersProvisionedResource.Builder.newInstance() .id(UUID.randomUUID().toString()) diff --git a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersResourceDefinitionTest.java b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersResourceDefinitionTest.java index 454c385b4..a549ab00c 100644 --- a/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersResourceDefinitionTest.java +++ b/edc-extensions/provision-additional-headers/src/test/java/org/eclipse/tractusx/edc/provision/additionalheaders/AdditionalHeadersResourceDefinitionTest.java @@ -20,7 +20,7 @@ package org.eclipse.tractusx.edc.provision.additionalheaders; -import org.eclipse.edc.spi.types.TypeManager; +import org.eclipse.edc.json.JacksonTypeManager; import org.eclipse.edc.spi.types.domain.DataAddress; import org.junit.jupiter.api.Test; @@ -32,7 +32,7 @@ class AdditionalHeadersResourceDefinitionTest { @Test void serdes() { - var typeManager = new TypeManager(); + var typeManager = new JacksonTypeManager(); var definition = AdditionalHeadersResourceDefinition.Builder.newInstance() .id(UUID.randomUUID().toString()) diff --git a/edc-extensions/tokenrefresh-handler/src/main/java/org/eclipse/tractusx/edc/common/tokenrefresh/TokenRefreshHandlerExtension.java b/edc-extensions/tokenrefresh-handler/src/main/java/org/eclipse/tractusx/edc/common/tokenrefresh/TokenRefreshHandlerExtension.java index 2208cf6b8..a7a29598a 100644 --- a/edc-extensions/tokenrefresh-handler/src/main/java/org/eclipse/tractusx/edc/common/tokenrefresh/TokenRefreshHandlerExtension.java +++ b/edc-extensions/tokenrefresh-handler/src/main/java/org/eclipse/tractusx/edc/common/tokenrefresh/TokenRefreshHandlerExtension.java @@ -61,7 +61,7 @@ public TokenRefreshHandler createTokenRefreshHander(ServiceExtensionContext cont private String getOwnDid(ServiceExtensionContext context) { var did = context.getConfig().getString(PARTICIPANT_DID_PROPERTY, null); if (did == null) { - RequiredConfigWarnings.warningNotPresent(context.getMonitor().withPrefix("Token Refresh Handler"), PARTICIPANT_DID_PROPERTY); + RequiredConfigWarnings.missingMandatoryProperty(context.getMonitor().withPrefix("Token Refresh Handler"), PARTICIPANT_DID_PROPERTY); } return did; } diff --git a/edc-extensions/transferprocess-sftp-client/build.gradle.kts b/edc-extensions/transferprocess-sftp-client/build.gradle.kts deleted file mode 100644 index 5ca1d98e2..000000000 --- a/edc-extensions/transferprocess-sftp-client/build.gradle.kts +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -plugins { - `maven-publish` - `java-library` -} - -dependencies { - implementation(project(":edc-extensions:transferprocess-sftp-common")) - implementation(libs.edc.spi.core) - implementation(libs.edc.spi.transfer) - implementation(libs.edc.spi.policy) - implementation(libs.edc.spi.dataplane.dataplane) - implementation(libs.edc.dpf.util) - implementation(libs.edc.dpf.core) - implementation(libs.edc.lib.policyengine) - implementation(libs.bouncyCastle.bcpkixJdk18on) - - implementation(libs.apache.sshd.core) - implementation(libs.apache.sshd.sftp) - - testImplementation(libs.awaitility) - testImplementation(libs.edc.junit) - - testImplementation(libs.testcontainers.junit) -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientConfig.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientConfig.java deleted file mode 100644 index bc2485350..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientConfig.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.sftp.client.SftpClient; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collection; -import java.util.List; - -public class SftpClientConfig { - private int bufferSize = 4096; - private boolean hostVerification = true; - private Path knownHostFile = Paths.get(System.getenv("HOME"), ".ssh/known_hosts"); - private int connectionTimeoutSeconds = 10; - private Collection writeOpenModes = - List.of(SftpClient.OpenMode.Create, SftpClient.OpenMode.Write); - private Collection readOpenModes = List.of(SftpClient.OpenMode.Read); - private SftpUser sftpUser; - private SftpLocation sftpLocation; - - public SftpUser getSftpUser() { - return sftpUser; - } - - public SftpLocation getSftpLocation() { - return sftpLocation; - } - - public int getBufferSize() { - return bufferSize; - } - - public boolean isHostVerification() { - return hostVerification; - } - - public Path getKnownHostFile() { - return knownHostFile; - } - - public int getConnectionTimeoutSeconds() { - return connectionTimeoutSeconds; - } - - public Collection getWriteOpenModes() { - return writeOpenModes; - } - - public Collection getReadOpenModes() { - return readOpenModes; - } - - - public static class Builder { - - private final SftpClientConfig config; - - private Builder() { - config = new SftpClientConfig(); - } - - public static Builder newInstance() { - return new Builder(); - } - - public static Builder sftpClientConfig() { - return new Builder(); - } - - public Builder sftpUser(SftpUser sftpUser) { - this.config.sftpUser = sftpUser; - return this; - } - - public Builder sftpLocation(SftpLocation sftpLocation) { - this.config.sftpLocation = sftpLocation; - return this; - } - - public Builder bufferSize(int bufferSize) { - this.config.bufferSize = bufferSize; - return this; - } - - public Builder hostVerification(boolean hostVerification) { - this.config.hostVerification = hostVerification; - return this; - } - - public Builder knownHostFile(Path knownHostFile) { - this.config.knownHostFile = knownHostFile; - return this; - } - - public Builder connectionTimeoutSeconds(int connectionTimeoutSeconds) { - this.config.connectionTimeoutSeconds = connectionTimeoutSeconds; - return this; - } - - public Builder writeOpenModes(Collection writeOpenModes) { - this.config.writeOpenModes = writeOpenModes; - return this; - } - - public Builder readOpenModes(Collection readOpenModes) { - this.config.readOpenModes = readOpenModes; - return this; - } - - public SftpClientConfig build() { - return config; - } - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientExtension.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientExtension.java deleted file mode 100644 index 4942c41b8..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientExtension.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService; -import org.eclipse.edc.runtime.metamodel.annotation.Inject; -import org.eclipse.edc.runtime.metamodel.annotation.Provides; -import org.eclipse.edc.spi.system.ServiceExtension; -import org.eclipse.edc.spi.system.ServiceExtensionContext; - -@Provides(SftpClientWrapper.class) -public class SftpClientExtension implements ServiceExtension { - - @Inject - PipelineService pipelineService; - - @Override - public void initialize(ServiceExtensionContext context) { - SftpDataSinkFactory sftpDataSinkFactory = new SftpDataSinkFactory(); - SftpDataSourceFactory sftpDataSourceFactory = new SftpDataSourceFactory(); - SftpClientWrapperFactory sftpClientWrapperFactory = new SftpClientWrapperFactoryImpl(); - - pipelineService.registerFactory(sftpDataSinkFactory); - pipelineService.registerFactory(sftpDataSourceFactory); - context.registerService(SftpClientWrapperFactory.class, sftpClientWrapperFactory); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapper.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapper.java deleted file mode 100644 index 6a3a4dd3a..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapper.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import java.io.IOException; -import java.io.InputStream; - -public interface SftpClientWrapper { - void uploadFile(InputStream inputStream) throws IOException; - - InputStream downloadFile() throws IOException; -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperFactory.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperFactory.java deleted file mode 100644 index 261b09c00..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -public interface SftpClientWrapperFactory { - SftpClientWrapper getSftpClientWrapper(SftpClientConfig config); -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperFactoryImpl.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperFactoryImpl.java deleted file mode 100644 index 2272b0980..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperFactoryImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -public class SftpClientWrapperFactoryImpl implements SftpClientWrapperFactory { - - @Override - public SftpClientWrapper getSftpClientWrapper(SftpClientConfig config) { - return new SftpClientWrapperImpl(config); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperImpl.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperImpl.java deleted file mode 100644 index 0af1ab723..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperImpl.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.client.ClientBuilder; -import org.apache.sshd.client.SshClient; -import org.apache.sshd.client.auth.password.PasswordIdentityProvider; -import org.apache.sshd.client.keyverifier.KnownHostsServerKeyVerifier; -import org.apache.sshd.client.keyverifier.RejectAllServerKeyVerifier; -import org.apache.sshd.client.keyverifier.ServerKeyVerifier; -import org.apache.sshd.client.session.ClientSession; -import org.apache.sshd.common.keyprovider.KeyIdentityProvider; -import org.apache.sshd.sftp.client.SftpClient; -import org.apache.sshd.sftp.client.SftpClientFactory; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.EdcSftpException; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.io.InputStream; -import java.time.Duration; - -public class SftpClientWrapperImpl implements SftpClientWrapper { - private final SftpClientConfig config; - private final SftpClient sftpClient; - - public SftpClientWrapperImpl(SftpClientConfig config) { - this.config = config; - try { - this.sftpClient = getSftpClient(config); - } catch (IOException e) { - throw new EdcSftpException("Unable to create SftpClient.", e); - } - } - - public SftpClientWrapperImpl(SftpClientConfig config, SftpClient sftpClient) { - this.config = config; - this.sftpClient = sftpClient; - } - - static SftpClient getSftpClient(SftpClientConfig config) throws IOException { - var session = getSshClientSession(config); - var factory = SftpClientFactory.instance(); - var sftpClient = factory.createSftpClient(session); - return sftpClient.singleSessionInstance(); - } - - private static ClientSession getSshClientSession(SftpClientConfig config) throws IOException { - var sshClient = getSshClient(config); - sshClient.start(); - var session = sshClient.connect(config.getSftpUser().getName(), config.getSftpLocation().getHost(), config.getSftpLocation().getPort()).verify().getSession(); - session.auth().await(Duration.ofSeconds(config.getConnectionTimeoutSeconds())); - - return session; - } - - private static SshClient getSshClient(SftpClientConfig config) { - final var sshClient = ClientBuilder.builder().build(); - - if (config.getSftpUser().getKeyPair() != null) { - sshClient.setKeyIdentityProvider(KeyIdentityProvider.wrapKeyPairs(config.getSftpUser().getKeyPair())); - } else if (config.getSftpUser().getPassword() != null) { - sshClient.setPasswordIdentityProvider(PasswordIdentityProvider.wrapPasswords(config.getSftpUser().getPassword())); - } else { - sshClient.setPasswordIdentityProvider(PasswordIdentityProvider.EMPTY_PASSWORDS_PROVIDER); - } - - if (config.isHostVerification()) { - final ServerKeyVerifier keyVerifier = new KnownHostsServerKeyVerifier(RejectAllServerKeyVerifier.INSTANCE, config.getKnownHostFile()); - sshClient.setServerKeyVerifier(keyVerifier); - } - - return sshClient; - } - - public SftpClientConfig getConfig() { - return config; - } - - public SftpClient getSftpClient() { - return sftpClient; - } - - @Override - public void uploadFile(final InputStream inputStream) throws IOException { - try (var outputStream = sftpClient.write(config.getSftpLocation().getPath(), config.getBufferSize(), config.getWriteOpenModes())) { - inputStream.transferTo(outputStream); - } - } - - @Override - public InputStream downloadFile() throws IOException { - final InputStream delegateInputStream; - try { - delegateInputStream = sftpClient.read(config.getSftpLocation().getPath(), config.getBufferSize(), config.getReadOpenModes()); - } catch (final IOException e) { - sftpClient.close(); - throw new EdcSftpException(String.format("Unable to download file at %s", config.getSftpLocation().toString()), e); - } - - return new SftpInputStreamWrapper(sftpClient, delegateInputStream); - } - - private static class SftpInputStreamWrapper extends InputStream { - private final SftpClient sftpClient; - private final InputStream delegateInputStream; - - private SftpInputStreamWrapper(SftpClient sftpClient, InputStream delegateInputStream) { - this.sftpClient = sftpClient; - this.delegateInputStream = delegateInputStream; - } - - @Override - public int read() throws IOException { - return delegateInputStream.read(); - } - - @Override - public int read(byte @NotNull [] b, int off, int len) throws IOException { - return delegateInputStream.read(b, off, len); - } - - @Override - public void close() { - try { - delegateInputStream.close(); - } catch (IOException ignored) { - // Ignored. The exception should only be thrown of the stream is already closed. - } - - try { - sftpClient.close(); - } catch (IOException ignored) { - // Ignored. The exception should only be thrown of the client is already closed. - } - } - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSink.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSink.java deleted file mode 100644 index f5385f130..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSink.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource; -import org.eclipse.edc.connector.dataplane.spi.pipeline.StreamResult; -import org.eclipse.edc.connector.dataplane.util.sink.ParallelSink; - -import java.io.IOException; -import java.util.List; - -public class SftpDataSink extends ParallelSink { - private final SftpClientWrapper sftpClientWrapper; - - public SftpDataSink(SftpClientWrapper sftpClientWrapper) { - this.sftpClientWrapper = sftpClientWrapper; - } - - - @Override - protected StreamResult transferParts(List parts) { - for (DataSource.Part part : parts) { - try { - sftpClientWrapper.uploadFile(part.openStream()); - } catch (IOException e) { - return StreamResult.error(e.getMessage()); - } - } - return StreamResult.success(); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkFactory.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkFactory.java deleted file mode 100644 index 13089d78e..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkFactory.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.sftp.client.SftpClient; -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSink; -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSinkFactory; -import org.eclipse.edc.spi.result.Result; -import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.EdcSftpException; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class SftpDataSinkFactory implements DataSinkFactory { - @Override - public boolean canHandle(DataFlowStartMessage request) { - try { - SftpDataAddress.fromDataAddress(request.getDestinationDataAddress()); - return true; - } catch (EdcSftpException e) { - return false; - } - } - - @Override - public DataSink createSink(DataFlowStartMessage request) { - if (!canHandle(request)) { - return null; - } - - SftpDataAddress destination = - SftpDataAddress.fromDataAddress(request.getDestinationDataAddress()); - - SftpClientConfig sftpClientConfig = - SftpClientConfig.Builder.newInstance() - .writeOpenModes(List.of(SftpClient.OpenMode.Create, SftpClient.OpenMode.Append)) - .sftpUser(destination.getSftpUser()) - .sftpLocation(destination.getSftpLocation()) - .build(); - - SftpClientWrapper sftpClientWrapper = new SftpClientWrapperImpl(sftpClientConfig); - - return new SftpDataSink(sftpClientWrapper); - } - - @Override - public @NotNull Result validateRequest(DataFlowStartMessage request) { - if (!canHandle(request)) { - return Result.failure(String.format("Invalid DataFlowStartMessage: %s", request.getId())); - } - - return Result.success(); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSource.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSource.java deleted file mode 100644 index a1df6efe9..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSource.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource; -import org.eclipse.edc.connector.dataplane.spi.pipeline.StreamResult; - -import java.util.stream.Stream; - -public class SftpDataSource implements DataSource { - private final SftpClientWrapper sftpClientWrapper; - - public SftpDataSource(SftpClientWrapper sftpClientWrapper) { - this.sftpClientWrapper = sftpClientWrapper; - } - - - @Override - public StreamResult> openPartStream() { - Part sftpPart = new SftpPart(sftpClientWrapper); - return StreamResult.success(Stream.of(sftpPart)); - } - - @Override - public void close() throws Exception { - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceFactory.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceFactory.java deleted file mode 100644 index b85fa3410..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource; -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSourceFactory; -import org.eclipse.edc.spi.result.Result; -import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.EdcSftpException; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.jetbrains.annotations.NotNull; - -public class SftpDataSourceFactory implements DataSourceFactory { - @Override - public boolean canHandle(DataFlowStartMessage request) { - try { - SftpDataAddress.fromDataAddress(request.getSourceDataAddress()); - return true; - } catch (EdcSftpException e) { - return false; - } - } - - @Override - public DataSource createSource(DataFlowStartMessage request) { - if (!canHandle(request)) { - return null; - } - - SftpDataAddress source = SftpDataAddress.fromDataAddress(request.getSourceDataAddress()); - - SftpClientConfig sftpClientConfig = - SftpClientConfig.Builder.newInstance() - .sftpUser(source.getSftpUser()) - .sftpLocation(source.getSftpLocation()) - .build(); - - SftpClientWrapper sftpClientWrapper = new SftpClientWrapperImpl(sftpClientConfig); - return new SftpDataSource(sftpClientWrapper); - } - - @Override - public @NotNull Result validateRequest(DataFlowStartMessage request) { - if (!canHandle(request)) { - return Result.failure(String.format("Invalid DataFlowStartMessage: %s", request.getId())); - } - return Result.success(); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpPart.java b/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpPart.java deleted file mode 100644 index db3af93ed..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpPart.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.EdcSftpException; - -import java.io.IOException; -import java.io.InputStream; - -public class SftpPart implements DataSource.Part { - private final SftpClientWrapper sftpClientWrapper; - - public SftpPart(SftpClientWrapper sftpClientWrapper) { - this.sftpClientWrapper = sftpClientWrapper; - } - - @Override - public String name() { - return ((SftpClientWrapperImpl) sftpClientWrapper).getConfig().getSftpLocation().getPath(); - } - - @Override - public InputStream openStream() { - try { - return sftpClientWrapper.downloadFile(); - } catch (IOException e) { - throw new EdcSftpException(e); - } - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension b/edc-extensions/transferprocess-sftp-client/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension deleted file mode 100644 index 03d56f041..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +++ /dev/null @@ -1,20 +0,0 @@ -################################################################################# -# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# 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. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - -org.eclipse.tractusx.edc.transferprocess.sftp.client.SftpClientExtension diff --git a/edc-extensions/transferprocess-sftp-client/src/main/resources/logback.xml b/edc-extensions/transferprocess-sftp-client/src/main/resources/logback.xml deleted file mode 100644 index 3347fcbae..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/main/resources/logback.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - %d{HH:mm:ss.SSS} [%thread] sdfsfs %-5level %logger{36} - %msg%n - - - - - - diff --git a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/AbstractSftpClientWrapperIntegrationTest.java b/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/AbstractSftpClientWrapperIntegrationTest.java deleted file mode 100644 index 336e3a8e2..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/AbstractSftpClientWrapperIntegrationTest.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.bouncycastle.crypto.params.RSAKeyParameters; -import org.bouncycastle.crypto.util.OpenSSHPublicKeyUtil; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.ClassRule; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.ArgumentsProvider; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.strategy.Wait; -import org.testcontainers.junit.jupiter.Container; -import org.testcontainers.shaded.org.apache.commons.io.IOUtils; -import org.testcontainers.shaded.org.apache.commons.lang3.RandomUtils; -import org.testcontainers.utility.DockerImageName; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.attribute.PosixFilePermission; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; -import java.security.interfaces.RSAPublicKey; -import java.util.Base64; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.stream.Stream; - -import static java.util.concurrent.TimeUnit.SECONDS; -import static org.testcontainers.shaded.org.awaitility.Awaitility.await; - -abstract class AbstractSftpClientWrapperIntegrationTest { - static final String DOCKER_IMAGE_NAME = "atmoz/sftp:alpine-3.6"; - static final String SFTP_PATH_PREFIX = "transfer"; - static final Map DOCKER_ENV = - Map.of("SFTP_USERS", String.format("user:password:::%s", SFTP_PATH_PREFIX)); - static final Path DOCKER_VOLUME_DIRECTORY; - static final Path REMOTE_PASSWORD_UPLOAD_DIRECTORY; - static final Path REMOTE_PASSWORD_DOWNLOAD_DIRECTORY; - static final Path REMOTE_KEYPAIR_UPLOAD_DIRECTORY; - static final Path REMOTE_KEYPAIR_DOWNLOAD_DIRECTORY; - static final Path LOCAL_UPLOAD_AND_GENERATOR_DIRECTORY; - static final Path KEY_DIRECTORY; - static final Path PUBLIC_KEY_PATH; - static final KeyPair KEY_PAIR; - @Container - @ClassRule - private static final GenericContainer SFTP_CONTAINER; - - static { - KEY_PAIR = generateKeyPair(); - - try { - Set fullPermission = new HashSet(); - fullPermission.add(PosixFilePermission.OWNER_EXECUTE); - fullPermission.add(PosixFilePermission.OWNER_READ); - fullPermission.add(PosixFilePermission.OWNER_WRITE); - fullPermission.add(PosixFilePermission.GROUP_EXECUTE); - fullPermission.add(PosixFilePermission.GROUP_READ); - fullPermission.add(PosixFilePermission.GROUP_WRITE); - fullPermission.add(PosixFilePermission.OTHERS_EXECUTE); - fullPermission.add(PosixFilePermission.OTHERS_READ); - fullPermission.add(PosixFilePermission.OTHERS_WRITE); - - DOCKER_VOLUME_DIRECTORY = Files.createTempDirectory(SftpClientWrapperIntegrationTest.class.getName()); - LOCAL_UPLOAD_AND_GENERATOR_DIRECTORY = - Files.createTempDirectory(SftpClientWrapperIntegrationTest.class.getName()); - REMOTE_PASSWORD_UPLOAD_DIRECTORY = - Files.createDirectory(DOCKER_VOLUME_DIRECTORY.resolve("passwordUpload")); - REMOTE_PASSWORD_DOWNLOAD_DIRECTORY = - Files.createDirectory(DOCKER_VOLUME_DIRECTORY.resolve("passwordDownload")); - REMOTE_KEYPAIR_UPLOAD_DIRECTORY = - Files.createDirectory(DOCKER_VOLUME_DIRECTORY.resolve("keypairUpload")); - REMOTE_KEYPAIR_DOWNLOAD_DIRECTORY = - Files.createDirectory(DOCKER_VOLUME_DIRECTORY.resolve("keypairDownload")); - KEY_DIRECTORY = Files.createTempDirectory(SftpClientWrapperIntegrationTest.class.getName()); - PUBLIC_KEY_PATH = KEY_DIRECTORY.resolve("public"); - - try (var fileWriter = - new OutputStreamWriter(new FileOutputStream(PUBLIC_KEY_PATH.toString()))) { - final RSAPublicKey publicKey = (RSAPublicKey) KEY_PAIR.getPublic(); - final RSAKeyParameters publicKeyParameters = - new RSAKeyParameters(false, publicKey.getModulus(), publicKey.getPublicExponent()); - byte[] encodedKey = OpenSSHPublicKeyUtil.encodePublicKey(publicKeyParameters); - String keyString = Base64.getEncoder().encodeToString(encodedKey); - String authKeysEntry = String.format("ssh-rsa %s", keyString); - fileWriter.write(authKeysEntry); - } - - Files.setPosixFilePermissions(DOCKER_VOLUME_DIRECTORY, fullPermission); - Files.setPosixFilePermissions(REMOTE_PASSWORD_UPLOAD_DIRECTORY, fullPermission); - Files.setPosixFilePermissions(REMOTE_PASSWORD_DOWNLOAD_DIRECTORY, fullPermission); - Files.setPosixFilePermissions(REMOTE_KEYPAIR_UPLOAD_DIRECTORY, fullPermission); - Files.setPosixFilePermissions(REMOTE_KEYPAIR_DOWNLOAD_DIRECTORY, fullPermission); - Files.setPosixFilePermissions(KEY_DIRECTORY, fullPermission); - } catch (IOException e) { - throw new RuntimeException(); - } - - SFTP_CONTAINER = - new GenericContainer<>(DockerImageName.parse(DOCKER_IMAGE_NAME)) - .withEnv(DOCKER_ENV) - .withExposedPorts(22) - .waitingFor(Wait.forListeningPort()) - .withFileSystemBind( - DOCKER_VOLUME_DIRECTORY.toAbsolutePath().toString(), - String.format("/home/user/%s", SFTP_PATH_PREFIX)) - .withFileSystemBind(KEY_DIRECTORY.toAbsolutePath().toString(), "/home/user/keys"); - SFTP_CONTAINER.start(); - - await().atMost(10, SECONDS).until(SFTP_CONTAINER::isRunning); - - try { - SFTP_CONTAINER.execInContainer("mkdir", "-p", "/home/user/.ssh"); - SFTP_CONTAINER.execInContainer("chmod", "700", "/home/user/.ssh"); - SFTP_CONTAINER.execInContainer("chown", "user", "/home/user/.ssh/"); - SFTP_CONTAINER.execInContainer( - "cp", "-f", "/home/user/keys/public", "/home/user/.ssh/authorized_keys"); - SFTP_CONTAINER.execInContainer("chown", "user", "/home/user/.ssh/authorized_keys"); - SFTP_CONTAINER.execInContainer("chmod", "600", "/home/user/.ssh/authorized_keys"); - } catch (IOException | InterruptedException e) { - throw new RuntimeException(); - } - } - - @AfterAll - static void tearDown() throws IOException { - if (Files.exists(DOCKER_VOLUME_DIRECTORY)) { - Files.walk(DOCKER_VOLUME_DIRECTORY) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - if (Files.exists(LOCAL_UPLOAD_AND_GENERATOR_DIRECTORY)) { - Files.walk(LOCAL_UPLOAD_AND_GENERATOR_DIRECTORY) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - if (Files.exists(KEY_DIRECTORY)) { - Files.walk(KEY_DIRECTORY) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - } - - private static KeyPair generateKeyPair() { - try { - KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); - keyPairGenerator.initialize(2048); - return keyPairGenerator.generateKeyPair(); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - } - - protected SftpUser getPasswordUser() { - return SftpUser.Builder.newInstance().name("user").password("password").build(); - } - - protected SftpUser getKeyPairUser() { - return SftpUser.Builder.newInstance().name("user").keyPair(KEY_PAIR).build(); - } - - protected SftpLocation getSftpLocation(String path) { - return SftpLocation.Builder.newInstance() - .host("127.0.0.1") - .port(SFTP_CONTAINER.getFirstMappedPort()) - .path(path) - .build(); - } - - protected SftpClientWrapper getSftpClient(SftpLocation location, SftpUser sftpUser) { - SftpClientConfig config = - SftpClientConfig.Builder.newInstance() - .sftpLocation(location) - .sftpUser(sftpUser) - .hostVerification(false) - .build(); - return new SftpClientWrapperImpl(config); - } - - protected static class FilesProvider implements ArgumentsProvider { - private static final int BUFFER_SIZE = 4 * 1024 * 1024; - - @Override - public Stream provideArguments(ExtensionContext context) { - return Stream.of( - Arguments.of(get1KbFile()), Arguments.of(get1MbFile()), Arguments.of(get2MbFile())); - } - - public File get1KbFile() { - return generateFile(1024); - } - - public File get1MbFile() { - return generateFile(1024 * 1024); - } - - public File get2MbFile() { - return generateFile(2 * 1024 * 1024); - } - - private File generateFile(final int byteSize) { - Path path = LOCAL_UPLOAD_AND_GENERATOR_DIRECTORY.resolve(String.format("%s.bin", byteSize)); - if (!Files.exists(path)) { - try { - Files.createFile(path); - } catch (IOException e) { - throw new RuntimeException(e); - } - try (var outputStream = Files.newOutputStream(path)) { - int bufferSize; - int remaining = byteSize; - do { - bufferSize = Math.min(remaining, BUFFER_SIZE); - byte[] chunk = RandomUtils.nextBytes(bufferSize); - IOUtils.write(chunk, outputStream); - remaining = remaining - bufferSize; - } while (remaining > 0); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - return path.toFile(); - } - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperIntegrationTest.java b/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperIntegrationTest.java deleted file mode 100644 index 3361f2b80..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperIntegrationTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.eclipse.edc.junit.extensions.EdcExtension; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ArgumentsSource; -import org.testcontainers.junit.jupiter.Testcontainers; -import org.testcontainers.shaded.org.apache.commons.io.IOUtils; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; - -import static java.lang.String.format; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@Disabled("Does not work") -@Testcontainers -@ExtendWith(EdcExtension.class) -class SftpClientWrapperIntegrationTest extends AbstractSftpClientWrapperIntegrationTest { - - @ParameterizedTest - @ArgumentsSource(FilesProvider.class) - void uploadFileWithPassword(File file) throws IOException { - var sftpUser = getPasswordUser(); - var sftpLocation = getSftpLocation(format("%s/%s/%s", SFTP_PATH_PREFIX, REMOTE_PASSWORD_UPLOAD_DIRECTORY.getFileName().toString(), file.getName())); - - var fileStream = Files.newInputStream(file.toPath()); - - getSftpClient(sftpLocation, sftpUser).uploadFile(fileStream); - - var uploadedFilePath = REMOTE_PASSWORD_UPLOAD_DIRECTORY.resolve(file.getName()); - assertTrue(Files.exists(uploadedFilePath)); - - var source = Files.newInputStream(file.toPath()); - var target = Files.newInputStream(uploadedFilePath); - - assertTrue(IOUtils.contentEquals(source, target), - format("File %s should have same content as file %s", file.toPath(), uploadedFilePath)); - } - - @ParameterizedTest - @ArgumentsSource(FilesProvider.class) - void uploadFileWithKeyPair(File file) throws IOException { - var sftpUser = getKeyPairUser(); - var sftpLocation = - getSftpLocation( - format( - "%s/%s/%s", - SFTP_PATH_PREFIX, - REMOTE_KEYPAIR_UPLOAD_DIRECTORY.getFileName().toString(), - file.getName())); - - var fileStream = Files.newInputStream(file.toPath()); - - getSftpClient(sftpLocation, sftpUser).uploadFile(fileStream); - - var uploadedFilePath = REMOTE_KEYPAIR_UPLOAD_DIRECTORY.resolve(file.getName()); - assertTrue(Files.exists(uploadedFilePath)); - - var source = Files.newInputStream(file.toPath()); - var target = Files.newInputStream(uploadedFilePath); - - assertTrue(IOUtils.contentEquals(source, target), - format("File %s should have same content as file %s", file.toPath(), uploadedFilePath)); - } - - @ParameterizedTest - @ArgumentsSource(FilesProvider.class) - void downloadFileWithPassword(File file) throws IOException { - var sftpUser = getPasswordUser(); - var sftpLocation = getSftpLocation( - format("%s/%s/%s", SFTP_PATH_PREFIX, - REMOTE_PASSWORD_DOWNLOAD_DIRECTORY.getFileName().toString(), file.getName())); - - var fileToUpload = Files.newInputStream(file.toPath()); - Files.copy(fileToUpload, - REMOTE_PASSWORD_DOWNLOAD_DIRECTORY, - StandardCopyOption.REPLACE_EXISTING); - - var source = Files.newInputStream(file.toPath()); - var target = getSftpClient(sftpLocation, sftpUser).downloadFile(); - - assertTrue(IOUtils.contentEquals(source, target), - format("File %s should have same content as file %s", file.toPath(), sftpLocation.getPath())); - } - - @ParameterizedTest - @ArgumentsSource(FilesProvider.class) - void downloadFileWithKeyPair(File file) throws IOException { - var sftpUser = getKeyPairUser(); - var sftpLocation = getSftpLocation(format("%s/%s/%s", SFTP_PATH_PREFIX, REMOTE_KEYPAIR_DOWNLOAD_DIRECTORY.getFileName().toString(), file.getName())); - - var fileToUpload = Files.newInputStream(file.toPath()); - Files.copy(fileToUpload, REMOTE_KEYPAIR_DOWNLOAD_DIRECTORY.resolve(file.getName()), StandardCopyOption.REPLACE_EXISTING); - - var source = Files.newInputStream(file.toPath()); - var target = getSftpClient(sftpLocation, sftpUser).downloadFile(); - - assertTrue(IOUtils.contentEquals(source, target), - format("File %s should have same content as file %s", file.toPath(), sftpLocation.getPath())); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperTest.java b/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperTest.java deleted file mode 100644 index 984f59176..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpClientWrapperTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.sftp.client.SftpClient; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -class SftpClientWrapperTest { - @Test - void uploadFile() throws IOException { - SftpUser userMock = Mockito.mock(SftpUser.class); - SftpLocation locationMock = Mockito.mock(SftpLocation.class); - SftpClientConfig sftpClientConfig = - SftpClientConfig.Builder.newInstance().sftpUser(userMock).sftpLocation(locationMock).build(); - SftpClient sftpClientMock = Mockito.mock(SftpClient.class); - SftpClientWrapperImpl sftpClientWrapper = - Mockito.spy(new SftpClientWrapperImpl(sftpClientConfig, sftpClientMock)); - byte[] content = new byte[]{0, 1, 2}; - InputStream inputStream = new ByteArrayInputStream(content); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - - Mockito.when(locationMock.getPath()).thenReturn("path"); - Mockito.when( - sftpClientMock.write(Mockito.anyString(), Mockito.anyInt(), Mockito.anyCollection())) - .thenReturn(outputStream); - sftpClientWrapper.uploadFile(inputStream); - - Assertions.assertArrayEquals(content, outputStream.toByteArray()); - Mockito.verify(sftpClientMock, Mockito.times(1)) - .write("path", 4096, List.of(SftpClient.OpenMode.Create, SftpClient.OpenMode.Write)); - } - - @Test - void downloadFile() throws IOException { - SftpUser userMock = Mockito.mock(SftpUser.class); - SftpLocation locationMock = Mockito.mock(SftpLocation.class); - SftpClientConfig sftpClientConfig = - SftpClientConfig.Builder.newInstance().sftpUser(userMock).sftpLocation(locationMock).build(); - SftpClient sftpClientMock = Mockito.mock(SftpClient.class); - SftpClientWrapperImpl sftpClientWrapper = - Mockito.spy(new SftpClientWrapperImpl(sftpClientConfig, sftpClientMock)); - byte[] content = new byte[]{0, 1, 2}; - InputStream inputStream = new ByteArrayInputStream(content); - - Mockito.when(locationMock.getPath()).thenReturn("path"); - Mockito.when( - sftpClientMock.read(Mockito.anyString(), Mockito.anyInt(), Mockito.anyCollection())) - .thenReturn(inputStream); - - try (InputStream resultStream = sftpClientWrapper.downloadFile()) { - Assertions.assertArrayEquals(content, resultStream.readAllBytes()); - Mockito.verify(sftpClientMock, Mockito.times(1)) - .read("path", 4096, List.of(SftpClient.OpenMode.Read)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkFactoryTest.java b/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkFactoryTest.java deleted file mode 100644 index 85225e4e3..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkFactoryTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.sftp.client.SftpClient; -import org.eclipse.edc.spi.types.domain.DataAddress; -import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import java.util.List; -import java.util.Map; - -class SftpDataSinkFactoryTest { - - @Test - void validate_valid() { - var dataSinkFactory = new SftpDataSinkFactory(); - var sftpUser = SftpUser.Builder.newInstance().name("name").build(); - var sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - - var sftpDataAddress = - SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var request = Mockito.mock(DataFlowStartMessage.class); - Mockito.when(request.getDestinationDataAddress()).thenReturn(sftpDataAddress); - - Assertions.assertTrue(dataSinkFactory.validateRequest(request).succeeded()); - } - - @Test - void validate_invalidDataAddressType() { - var dataSinkFactory = new SftpDataSinkFactory(); - var dataAddress = DataAddress.Builder.newInstance().type("wrong").build(); - var request = Mockito.mock(DataFlowStartMessage.class); - Mockito.when(request.getDestinationDataAddress()).thenReturn(dataAddress); - - Assertions.assertTrue(dataSinkFactory.validateRequest(request).failed()); - } - - @Test - void validate_invalidDataAddressParameters() { - var dataSinkFactory = new SftpDataSinkFactory(); - Map properties = - Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "notANumber", - "locationPath", "path", - "userName", "name", - "userPassword", "password"); - - final var dataAddress = - DataAddress.Builder.newInstance().properties(properties).build(); - var request = Mockito.mock(DataFlowStartMessage.class); - Mockito.when(request.getDestinationDataAddress()).thenReturn(dataAddress); - - Assertions.assertTrue(dataSinkFactory.validateRequest(request).failed()); - } - - @Test - void createSink_successful() { - var dataSinkFactory = new SftpDataSinkFactory(); - var sftpUser = SftpUser.Builder.newInstance().name("name").build(); - var sftpLocation = - SftpLocation.Builder.newInstance().host("127.0.0.1").port(22).path("path").build(); - var sftpClientConfig = - SftpClientConfig.Builder.newInstance() - .writeOpenModes(List.of(SftpClient.OpenMode.Create, SftpClient.OpenMode.Append)) - .sftpUser(sftpUser) - .sftpLocation(sftpLocation) - .build(); - - var sftpDataAddress = - SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var request = Mockito.mock(DataFlowStartMessage.class); - Mockito.when(request.getDestinationDataAddress()).thenReturn(sftpDataAddress); - - try (var staticWrapper = - Mockito.mockStatic(SftpClientWrapperImpl.class)) { - staticWrapper - .when(() -> SftpClientWrapperImpl.getSftpClient(sftpClientConfig)) - .thenReturn(Mockito.mock(SftpClient.class)); - Assertions.assertNotNull(dataSinkFactory.createSink(request)); - - staticWrapper.verify( - () -> SftpClientWrapperImpl.getSftpClient(Mockito.any()), Mockito.times(1)); - } - } - - @Test - void createSink_invalidDataAddressType() { - var dataSinkFactory = new SftpDataSinkFactory(); - var dataAddress = DataAddress.Builder.newInstance().type("wrong").build(); - var request = Mockito.mock(DataFlowStartMessage.class); - Mockito.when(request.getDestinationDataAddress()).thenReturn(dataAddress); - - Assertions.assertNull(dataSinkFactory.createSink(request)); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkTest.java b/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkTest.java deleted file mode 100644 index f6bc31902..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSinkTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.sftp.client.SftpClient; -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.List; - -class SftpDataSinkTest { - @Test - void transferParts() throws IOException { - var userMock = Mockito.mock(SftpUser.class); - var locationMock = Mockito.mock(SftpLocation.class); - var sftpClientConfig = - SftpClientConfig.Builder.newInstance() - .sftpUser(userMock) - .sftpLocation(locationMock) - .writeOpenModes(List.of(SftpClient.OpenMode.Create, SftpClient.OpenMode.Append)) - .build(); - var sftpClientMock = Mockito.mock(SftpClient.class); - var sftpClientWrapper = - Mockito.spy(new SftpClientWrapperImpl(sftpClientConfig, sftpClientMock)); - var sftpDataSink = Mockito.spy(new SftpDataSink(sftpClientWrapper)); - var outputStream = new ByteArrayOutputStream(); - - Mockito.when(sftpClientMock.write(Mockito.any(), Mockito.anyInt(), Mockito.anyCollection())) - .thenReturn(outputStream); - Mockito.when(locationMock.getPath()).thenReturn("path"); - - List parts = - Arrays.asList(new SftpTestPart(new byte[]{0, 1}), new SftpTestPart(new byte[]{2, 3})); - byte[] expected = {0, 1, 2, 3}; - - sftpDataSink.transferParts(parts); - - Assertions.assertArrayEquals(expected, outputStream.toByteArray()); - Mockito.verify(sftpClientMock, Mockito.times(2)) - .write("path", 4096, List.of(SftpClient.OpenMode.Create, SftpClient.OpenMode.Append)); - } - - private static class SftpTestPart implements DataSource.Part { - - final byte[] content; - - private SftpTestPart(byte[] content) { - this.content = content; - } - - @Override - public String name() { - return null; - } - - @Override - public InputStream openStream() { - return new ByteArrayInputStream(content); - } - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceFactoryTest.java b/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceFactoryTest.java deleted file mode 100644 index 8f32555ad..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceFactoryTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.sftp.client.SftpClient; -import org.eclipse.edc.spi.types.domain.DataAddress; -import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.util.Map; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.mockStatic; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - -class SftpDataSourceFactoryTest { - - @Test - void validate_valid() { - var dataSourceFactory = new SftpDataSourceFactory(); - var sftpUser = SftpUser.Builder.newInstance().name("name").build(); - var sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - - var sftpDataAddress = - SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var request = mock(DataFlowStartMessage.class); - when(request.getSourceDataAddress()).thenReturn(sftpDataAddress); - - Assertions.assertTrue(dataSourceFactory.validateRequest(request).succeeded()); - } - - @Test - void validate_invalidDataAddressType() { - var dataSourceFactory = new SftpDataSourceFactory(); - var dataAddress = DataAddress.Builder.newInstance().type("wrong").build(); - var request = mock(DataFlowStartMessage.class); - when(request.getSourceDataAddress()).thenReturn(dataAddress); - - Assertions.assertTrue(dataSourceFactory.validateRequest(request).failed()); - } - - @Test - void validate_invalidDataAddressParameters() { - var dataSourceFactory = new SftpDataSourceFactory(); - Map properties = - Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "notANumber", - "locationPath", "path", - "userName", "name", - "userPassword", "password"); - - var dataAddress = DataAddress.Builder.newInstance().properties(properties).build(); - var request = mock(DataFlowStartMessage.class); - when(request.getSourceDataAddress()).thenReturn(dataAddress); - - Assertions.assertTrue(dataSourceFactory.validateRequest(request).failed()); - } - - @Test - void createSink_successful() { - var dataSourceFactory = new SftpDataSourceFactory(); - var sftpUser = SftpUser.Builder.newInstance().name("name").build(); - var sftpLocation = - SftpLocation.Builder.newInstance().host("127.0.0.1").port(22).path("path").build(); - var sftpClientConfig = - SftpClientConfig.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - - var sftpDataAddress = - SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var request = mock(DataFlowStartMessage.class); - when(request.getSourceDataAddress()).thenReturn(sftpDataAddress); - - try (var staticWrapper = - mockStatic(SftpClientWrapperImpl.class)) { - staticWrapper - .when(() -> SftpClientWrapperImpl.getSftpClient(sftpClientConfig)) - .thenReturn(mock(SftpClient.class)); - Assertions.assertNotNull(dataSourceFactory.createSource(request)); - - staticWrapper.verify( - () -> SftpClientWrapperImpl.getSftpClient(any()), times(1)); - } - } - - @Test - void createSink_invalidDataAddressType() { - var dataSourceFactory = new SftpDataSourceFactory(); - var dataAddress = DataAddress.Builder.newInstance().type("wrong").build(); - var request = mock(DataFlowStartMessage.class); - when(request.getSourceDataAddress()).thenReturn(dataAddress); - - Assertions.assertNull(dataSourceFactory.createSource(request)); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceTest.java b/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceTest.java deleted file mode 100644 index 20b381023..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/client/SftpDataSourceTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.client; - -import org.apache.sshd.sftp.client.SftpClient; -import org.eclipse.edc.connector.dataplane.spi.pipeline.DataSource; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -class SftpDataSourceTest { - @Test - void openPartStream() throws IOException { - final SftpUser userMock = Mockito.mock(SftpUser.class); - final SftpLocation locationMock = Mockito.mock(SftpLocation.class); - final SftpClientConfig sftpClientConfig = - SftpClientConfig.Builder.newInstance().sftpUser(userMock).sftpLocation(locationMock).build(); - final SftpClient sftpClientMock = Mockito.mock(SftpClient.class); - final SftpClientWrapperImpl sftpClientWrapper = - Mockito.spy(new SftpClientWrapperImpl(sftpClientConfig, sftpClientMock)); - SftpDataSource sftpDataSource = Mockito.spy(new SftpDataSource(sftpClientWrapper)); - byte[] expected = new byte[]{0, 1, 2, 3}; - ByteArrayInputStream outputStream = new ByteArrayInputStream(expected); - - Mockito.when(locationMock.getPath()).thenReturn("path"); - Mockito.when( - sftpClientMock.read(Mockito.anyString(), Mockito.anyInt(), Mockito.anyCollection())) - .thenReturn(outputStream); - - Stream partStream = sftpDataSource.openPartStream().getContent(); - DataSource.Part part = partStream.collect(Collectors.toList()).get(0); - - Assertions.assertArrayEquals(expected, part.openStream().readAllBytes()); - Mockito.verify(sftpClientMock, Mockito.times(1)) - .read("path", 4096, List.of(SftpClient.OpenMode.Read)); - } -} diff --git a/edc-extensions/transferprocess-sftp-client/src/test/resources/logback.xml b/edc-extensions/transferprocess-sftp-client/src/test/resources/logback.xml deleted file mode 100644 index 3347fcbae..000000000 --- a/edc-extensions/transferprocess-sftp-client/src/test/resources/logback.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - %d{HH:mm:ss.SSS} [%thread] sdfsfs %-5level %logger{36} - %msg%n - - - - - - diff --git a/edc-extensions/transferprocess-sftp-common/build.gradle.kts b/edc-extensions/transferprocess-sftp-common/build.gradle.kts deleted file mode 100644 index 1448161c5..000000000 --- a/edc-extensions/transferprocess-sftp-common/build.gradle.kts +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -plugins { - `maven-publish` - `java-library` -} - -dependencies { - implementation(libs.edc.spi.core) - testImplementation(libs.edc.junit) - - testImplementation(libs.testcontainers.junit) -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/EdcSftpException.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/EdcSftpException.java deleted file mode 100644 index a0bde5bc8..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/EdcSftpException.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -import org.eclipse.edc.spi.EdcException; - -public class EdcSftpException extends EdcException { - public EdcSftpException(String message) { - super(message); - } - - public EdcSftpException(String message, Throwable cause) { - super(message, cause); - } - - public EdcSftpException(Throwable cause) { - super(cause); - } - - public EdcSftpException( - String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddress.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddress.java deleted file mode 100644 index 9364f24f3..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddress.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -import org.eclipse.edc.spi.types.domain.DataAddress; - -import java.util.Base64; - -import static java.lang.String.format; - -public class SftpDataAddress extends DataAddress { - private static final String LOCATION_HOST = "locationHost"; - private static final String LOCATION_PORT = "locationPort"; - private static final String LOCATION_PATH = "locationPath"; - private static final String USER_NAME = "userName"; - private static final String USER_PASSWORD = "userPassword"; - private static final String USER_PRIVATE_KEY = "userPrivateKey"; - - - private static final String CONNECTION_TYPE = "sftp"; - - private SftpDataAddress() { - - } - - public static SftpDataAddress fromDataAddress(DataAddress dataAddress) throws EdcSftpException { - if (dataAddress instanceof SftpDataAddress) { - return (SftpDataAddress) dataAddress; - } - - if (!dataAddress.getType().equalsIgnoreCase("sftp")) { - throw new EdcSftpException(format("Invalid DataAddress type: %s. Expected %s.", - dataAddress.getType(), CONNECTION_TYPE)); - } - - try { - var sftpUser = createSftpUser(dataAddress); - - var sftpLocation = createSftpLocation(dataAddress); - - return SftpDataAddress.Builder.newInstance() - .sftpUser(sftpUser) - .sftpLocation(sftpLocation) - .build(); - } catch (NullPointerException e) { - throw new EdcSftpException(e.getMessage(), e); - } catch (NumberFormatException e) { - throw new EdcSftpException(format("Port for SftpLocation %s/%s not a number", dataAddress.getStringProperty(LOCATION_HOST), dataAddress.getStringProperty(LOCATION_PATH)), e); - } - } - - private static SftpLocation createSftpLocation(DataAddress dataAddress) { - return SftpLocation.Builder.newInstance() - .host(dataAddress.getStringProperty(LOCATION_HOST)) - .port(Integer.parseInt(dataAddress.getStringProperty(LOCATION_PORT, "22"))) - .path(dataAddress.getStringProperty(LOCATION_PATH)) - .build(); - } - - private static SftpUser createSftpUser(DataAddress dataAddress) { - return SftpUser.Builder.newInstance() - .name(dataAddress.getStringProperty(USER_NAME)) - .password(dataAddress.getStringProperty(USER_PASSWORD)) - .keyPair(SftpUserKeyPairGenerator.getKeyPairFromPrivateKey( - dataAddress.getStringProperty(USER_PRIVATE_KEY), - dataAddress.getStringProperty(USER_NAME))) - .build(); - } - - public SftpUser getSftpUser() { - return createSftpUser(this); - } - - public SftpLocation getSftpLocation() { - return createSftpLocation(this); - } - - public static class Builder extends DataAddress.Builder { - protected Builder(SftpDataAddress address) { - super(address); - } - - public static Builder newInstance() { - return new Builder(new SftpDataAddress()); - } - - public Builder sftpUser(SftpUser user) { - this.address.getProperties().put(USER_NAME, user.getName()); - this.address.getProperties().put(USER_PASSWORD, user.getPassword()); - if (user.getKeyPair() != null) { - this.address.getProperties().put(USER_PRIVATE_KEY, Base64.getEncoder().encodeToString(user.getKeyPair().getPrivate().getEncoded())); - this.address.getProperties().put(EDC_DATA_ADDRESS_KEY_NAME, user.getName()); - } - return this; - } - - public Builder sftpLocation(SftpLocation location) { - this.address.getProperties().put(LOCATION_HOST, location.getHost()); - this.address.getProperties().put(LOCATION_PORT, String.valueOf(location.getPort())); - this.address.getProperties().put(LOCATION_PATH, location.getPath()); - return this; - } - - @Override - public SftpDataAddress build() { - address.setType(CONNECTION_TYPE); - - super.build(); //for validation - return address; - } - } - -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpLocation.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpLocation.java deleted file mode 100644 index 7894d9d6f..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpLocation.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -import java.util.Objects; - -public class SftpLocation { - private String host; - private int port; - private String path; - - public String getHost() { - return host; - } - - public int getPort() { - return port; - } - - public String getPath() { - return path; - } - - @Override - public String toString() { - return String.format("%s:%d/%s", host, port, path); - } - - - public static class Builder { - private final SftpLocation location; - - private Builder() { - location = new SftpLocation(); - } - - public static Builder newInstance() { - return new Builder(); - } - - public Builder host(String host) { - location.host = host; - return this; - } - - public Builder port(int port) { - location.port = port; - return this; - } - - public Builder path(String path) { - location.path = path; - return this; - } - - public SftpLocation build() { - Objects.requireNonNull(location.host, "host"); - Objects.requireNonNull(location.path, "path"); - if (location.port <= 0) { - throw new IllegalArgumentException("port must be > 0 but was " + location.port); - } - return location; - } - } -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpLocationFactory.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpLocationFactory.java deleted file mode 100644 index 9f37059ce..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpLocationFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -public interface SftpLocationFactory { - SftpLocation createSftpLocation(String sftpHost, Integer sftpPort, String sftpPath); -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpProvider.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpProvider.java deleted file mode 100644 index a82b2fc4e..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -public interface SftpProvider { - void createUser(SftpUser user); - - void deleteUser(SftpUser user); - - void createLocation(SftpLocation location); - - void deleteLocation(SftpLocation location); -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUser.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUser.java deleted file mode 100644 index b70fbaca7..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUser.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -import java.security.KeyPair; - -public class SftpUser { - private String name; - private String password; - private KeyPair keyPair; - - public String getName() { - return name; - } - - public String getPassword() { - return password; - } - - public KeyPair getKeyPair() { - return keyPair; - } - - public static class Builder { - private final SftpUser user; - - private Builder() { - user = new SftpUser(); - } - - public static Builder newInstance() { - return new Builder(); - } - - public Builder name(String name) { - user.name = name; - return this; - } - - public Builder password(String password) { - user.password = password; - return this; - } - - public Builder keyPair(KeyPair keyPair) { - user.keyPair = keyPair; - return this; - } - - public SftpUser build() { - return user; - } - } -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUserFactory.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUserFactory.java deleted file mode 100644 index dc701bf79..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUserFactory.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -public interface SftpUserFactory { - SftpUser createSftpUser(String sftpUserName, String sftpUserPassword, byte[] sftpUserKeypair); -} diff --git a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUserKeyPairGenerator.java b/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUserKeyPairGenerator.java deleted file mode 100644 index 1c341f9fb..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpUserKeyPairGenerator.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -import java.security.KeyFactory; -import java.security.KeyPair; -import java.security.NoSuchAlgorithmException; -import java.security.interfaces.RSAPrivateCrtKey; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.RSAPublicKeySpec; -import java.util.Base64; -import java.util.Objects; - -public class SftpUserKeyPairGenerator { - public static KeyPair getKeyPairFromPrivateKey(byte[] privateKeyBytes, String sftpUserName) { - Objects.requireNonNull(sftpUserName, "sftpUsername"); - if (privateKeyBytes == null) { - return null; - } - - try { - var keyFactory = KeyFactory.getInstance("RSA"); - var privateKey = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKeyBytes)); - - var privateKeySpec = (RSAPrivateCrtKey) privateKey; - - var publicKey = keyFactory.generatePublic(new RSAPublicKeySpec(privateKeySpec.getModulus(), privateKeySpec.getPublicExponent())); - return new KeyPair(publicKey, privateKey); - - } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { - throw new EdcSftpException(String.format("Unable to parse provided keypair for Sftp user %s", sftpUserName), e); - } - } - - public static KeyPair getKeyPairFromPrivateKey(String privateKeyBase64, String sftpUserName) { - if (privateKeyBase64 == null) { - return null; - } - - try { - var publicBytes = Base64.getDecoder().decode(privateKeyBase64); - return getKeyPairFromPrivateKey(publicBytes, sftpUserName); - } catch (IllegalArgumentException e) { - throw new EdcSftpException(String.format("Cannot decode base64 private key for user %s", sftpUserName), e); - } - - } -} diff --git a/edc-extensions/transferprocess-sftp-common/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddressTest.java b/edc-extensions/transferprocess-sftp-common/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddressTest.java deleted file mode 100644 index d568ca181..000000000 --- a/edc-extensions/transferprocess-sftp-common/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/common/SftpDataAddressTest.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.common; - -import org.eclipse.edc.spi.types.domain.DataAddress; -import org.junit.jupiter.api.Test; - -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; -import java.util.Base64; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; - -class SftpDataAddressTest { - - @Test - void fromDataAddress_password() { - Map properties = Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "22", - "locationPath", "path", - "userName", "name", - "userPassword", "password"); - - var dataAddress = DataAddress.Builder.newInstance().properties(properties).build(); - - var sftpDataAddress = SftpDataAddress.fromDataAddress(dataAddress); - - assertEquals("localhost", sftpDataAddress.getSftpLocation().getHost()); - assertEquals(22, sftpDataAddress.getSftpLocation().getPort()); - assertEquals("path", sftpDataAddress.getSftpLocation().getPath()); - assertEquals("name", sftpDataAddress.getSftpUser().getName()); - assertEquals("password", sftpDataAddress.getSftpUser().getPassword()); - assertNull(sftpDataAddress.getSftpUser().getKeyPair()); - } - - @Test - void fromDataAddress_keyPair() throws NoSuchAlgorithmException { - var keyPairGenerator = KeyPairGenerator.getInstance("RSA"); - keyPairGenerator.initialize(2048); - var keyPair = keyPairGenerator.generateKeyPair(); - var privateKeyBytes = keyPair.getPrivate().getEncoded(); - - Map properties = - Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "22", - "locationPath", "path", - "userName", "name", - "userPrivateKey", Base64.getEncoder().encodeToString(privateKeyBytes)); - - var dataAddress = - DataAddress.Builder.newInstance().properties(properties).build(); - - var sftpDataAddress = SftpDataAddress.fromDataAddress(dataAddress); - - assertEquals("localhost", sftpDataAddress.getSftpLocation().getHost()); - assertEquals(22, sftpDataAddress.getSftpLocation().getPort()); - assertEquals("path", sftpDataAddress.getSftpLocation().getPath()); - assertEquals("name", sftpDataAddress.getSftpUser().getName()); - assertArrayEquals( - privateKeyBytes, sftpDataAddress.getSftpUser().getKeyPair().getPrivate().getEncoded()); - assertNull(sftpDataAddress.getSftpUser().getPassword()); - } - - @Test - void fromDataAddress_noAuth() { - Map properties = - Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "22", - "locationPath", "path", - "userName", "name"); - - var dataAddress = - DataAddress.Builder.newInstance().properties(properties).build(); - - var sftpDataAddress = SftpDataAddress.fromDataAddress(dataAddress); - - assertEquals("localhost", sftpDataAddress.getSftpLocation().getHost()); - assertEquals(22, sftpDataAddress.getSftpLocation().getPort()); - assertEquals("path", sftpDataAddress.getSftpLocation().getPath()); - assertEquals("name", sftpDataAddress.getSftpUser().getName()); - assertNull(sftpDataAddress.getSftpUser().getPassword()); - } - - @Test - void fromDataAddress_invalidKeyPairBrokenBase64() { - Map properties = - Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "22", - "locationPath", "path", - "userName", "name", - "userPrivateKey", "clearlyNotAPrivateKey"); - - var dataAddress = - DataAddress.Builder.newInstance().properties(properties).build(); - - var edcSftpException = - assertThrows( - EdcSftpException.class, () -> SftpDataAddress.fromDataAddress(dataAddress)); - assertEquals( - "Cannot decode base64 private key for user name", edcSftpException.getMessage()); - } - - @Test - void fromDataAddress_invalidKeyPairButCorrectBase64() { - Map properties = - Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "22", - "locationPath", "path", - "userName", "name", - "userPrivateKey", "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu"); - - var dataAddress = - DataAddress.Builder.newInstance().properties(properties).build(); - - var edcSftpException = - assertThrows( - EdcSftpException.class, () -> SftpDataAddress.fromDataAddress(dataAddress)); - assertEquals( - "Unable to parse provided keypair for Sftp user name", edcSftpException.getMessage()); - } - - @Test - void fromDataAddress_portNaN() { - Map properties = - Map.of( - "type", "sftp", - "locationHost", "localhost", - "locationPort", "notANumber", - "locationPath", "path", - "userName", "name", - "userPassword", "password"); - - var dataAddress = DataAddress.Builder.newInstance().properties(properties).build(); - - var edcSftpException = - assertThrows( - EdcSftpException.class, () -> SftpDataAddress.fromDataAddress(dataAddress)); - assertEquals( - "Port for SftpLocation localhost/path not a number", edcSftpException.getMessage()); - } - - @Test - void fromDataAddress_missingParameter() { - Map properties = - Map.of( - "type", "sftp", - "locationPort", "22", - "locationPath", "path", - "userName", "name", - "userPassword", "password"); - - var dataAddress = DataAddress.Builder.newInstance().properties(properties).build(); - - assertThatThrownBy(() -> SftpDataAddress.fromDataAddress(dataAddress)) - .isInstanceOf(EdcSftpException.class) - .hasMessageStartingWith("host"); - } - - @Test - void fromDataAddress_notSftp() { - Map properties = - Map.of( - "type", "somethingOtherThanSftp", - "locationHost", "localhost", - "locationPort", "22", - "locationPath", "path", - "userName", "name", - "userPassword", "password"); - - var dataAddress = DataAddress.Builder.newInstance().properties(properties).build(); - - var edcSftpException = assertThrows(EdcSftpException.class, () -> SftpDataAddress.fromDataAddress(dataAddress)); - assertEquals("Invalid DataAddress type: somethingOtherThanSftp. Expected sftp.", - edcSftpException.getMessage()); - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/build.gradle.kts b/edc-extensions/transferprocess-sftp-provisioner/build.gradle.kts deleted file mode 100644 index 07f96e598..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/build.gradle.kts +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -plugins { - `maven-publish` - `java-library` -} - -dependencies { - implementation(project(":edc-extensions:transferprocess-sftp-common")) - - implementation(libs.edc.spi.core) - implementation(libs.edc.lib.policyengine) - implementation(libs.edc.spi.transfer) - - testImplementation(libs.edc.junit) - testImplementation(libs.testcontainers.junit) -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvider.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvider.java deleted file mode 100644 index 9b51d2f64..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvider.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpProvider; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; - -public class NoOpSftpProvider implements SftpProvider { - - /** - * This provisioner does not create cloud resources. The assumption is that users and locations - * already exist cloud-side. Thus, this method has no functionality. - * - * @param user The user whose credentials should be deployed. - */ - @Override - public void createUser(SftpUser user) { - // do nothing - } - - /** - * This provisioner does not create cloud resources. The assumption is that users and locations - * already exist cloud-side. Thus, this method has no functionality. - * - * @param user The user whose credentials should be deleted. - */ - @Override - public void deleteUser(SftpUser user) { - // do nothing - } - - /** - * This provisioner does not create cloud resources. The assumption is that users and locations - * already exist cloud-side. Thus, this method has no functionality. - * - * @param location The location of the cloud resource that should be made available. - */ - @Override - public void createLocation(SftpLocation location) { - // do nothing - } - - /** - * This provisioner does not create cloud resources. The assumption is that users and locations - * already exist cloud-side. Thus, this method has no functionality. - * - * @param location The location of the cloud resource that should be made unavailable. - */ - @Override - public void deleteLocation(SftpLocation location) { - // do nothing - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvisioner.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvisioner.java deleted file mode 100644 index a0dc9891d..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvisioner.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.edc.connector.controlplane.transfer.spi.provision.Provisioner; -import org.eclipse.edc.connector.controlplane.transfer.spi.types.DeprovisionedResource; -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ProvisionResponse; -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ProvisionedResource; -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ResourceDefinition; -import org.eclipse.edc.policy.engine.spi.PolicyEngine; -import org.eclipse.edc.policy.model.Policy; -import org.eclipse.edc.spi.response.ResponseStatus; -import org.eclipse.edc.spi.response.StatusResult; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.EdcSftpException; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; - -import java.util.Objects; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; - -public class NoOpSftpProvisioner implements Provisioner { - public static final String DATA_ADDRESS_TYPE = "sftp"; - public static final String PROVIDER_TYPE = "NoOp"; - - private final String policyScope; - private final PolicyEngine policyEngine; - private final NoOpSftpProvider sftpProvider; - - public NoOpSftpProvisioner(String policyScope, PolicyEngine policyEngine, NoOpSftpProvider sftpProvider) { - this.policyScope = policyScope; - this.policyEngine = policyEngine; - this.sftpProvider = sftpProvider; - } - - @Override - public boolean canProvision(ResourceDefinition resourceDefinition) { - Objects.requireNonNull(resourceDefinition, "resourceDefinition"); - if (!(resourceDefinition instanceof SftpProviderResourceDefinition)) { - return false; - } - if (!(((SftpProviderResourceDefinition) resourceDefinition) - .getProviderType() - .equals(PROVIDER_TYPE))) { - return false; - } - try { - SftpDataAddress.fromDataAddress(((SftpProviderResourceDefinition) resourceDefinition).getSftpDataAddress()); - } catch (EdcSftpException e) { - return false; - } - return true; - } - - @Override - public boolean canDeprovision(ProvisionedResource provisionedResource) { - Objects.requireNonNull(provisionedResource, "provisionedResource"); - if (!(provisionedResource instanceof SftpProvisionedContentResource)) { - return false; - } - - if (!(((SftpProvisionedContentResource) provisionedResource) - .getProviderType() - .equals(PROVIDER_TYPE))) { - return false; - } - - try { - SftpDataAddress.fromDataAddress(((SftpProvisionedContentResource) provisionedResource).getDataAddress()); - } catch (EdcSftpException e) { - return false; - } - return true; - } - - @Override - public CompletableFuture> provision(SftpProviderResourceDefinition sftpProviderResourceDefinition, Policy policy) { - - return CompletableFuture.supplyAsync( - () -> { - if (!this.canProvision(sftpProviderResourceDefinition)) { - return StatusResult.failure(ResponseStatus.FATAL_ERROR); - } - // As of the time of writing, policies don't actually do anything in this context. - // They are included here in case EDC wants to use them eventually. - Policy scopedPolicy; - scopedPolicy = policyEngine.filter(policy, policyScope); - sftpProvider.createLocation(sftpProviderResourceDefinition.getSftpDataAddress().getSftpLocation()); - sftpProvider.createUser(sftpProviderResourceDefinition.getSftpDataAddress().getSftpUser()); - - var randomId = UUID.randomUUID().toString(); - var sftpProvisionedContentResource = SftpProvisionedContentResource.Builder.newInstance() - .sftpDataAddress(sftpProviderResourceDefinition.getSftpDataAddress()) - .providerType(PROVIDER_TYPE) - .scopedPolicy(scopedPolicy) - .provisionedResourceId(randomId) - .resourceDefinitionId(sftpProviderResourceDefinition.getId()) - .provisionedResourceId( - generateResourceId( - sftpProviderResourceDefinition.getSftpDataAddress().getSftpUser(), - sftpProviderResourceDefinition.getSftpDataAddress().getSftpLocation())) - .build(); - - return StatusResult.success(ProvisionResponse.Builder.newInstance() - .resource(sftpProvisionedContentResource) - .build()); - }); - } - - @Override - public CompletableFuture> deprovision(SftpProvisionedContentResource sftpProvisionedContentResource, Policy policy) { - return CompletableFuture.supplyAsync( - () -> { - if (!this.canDeprovision(sftpProvisionedContentResource)) { - return StatusResult.failure(ResponseStatus.FATAL_ERROR); - } - // As of the time of writing, policies don't actually do anything in this context. - // They are included here in case EDC wants to use them eventually. - var dataAddress = sftpProvisionedContentResource.getSftpDataAddress(); - sftpProvider.deleteLocation(dataAddress.getSftpLocation()); - sftpProvider.deleteUser(dataAddress.getSftpUser()); - - DeprovisionedResource deprovisionedResource = - DeprovisionedResource.Builder.newInstance() - .provisionedResourceId(sftpProvisionedContentResource.getProvisionedResourceId()) - .inProcess(true) - .build(); - - return StatusResult.success(deprovisionedResource); - }); - } - - private String generateResourceId(SftpUser sftpUser, SftpLocation sftpLocation) { - return String.format( - "%s@%s:%d/%s", - sftpUser.getName(), sftpLocation.getHost(), sftpLocation.getPort(), sftpLocation.getPath()); - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpLocationFactoryImpl.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpLocationFactoryImpl.java deleted file mode 100644 index 8421884e8..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpLocationFactoryImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocationFactory; - -public class SftpLocationFactoryImpl implements SftpLocationFactory { - @Override - public SftpLocation createSftpLocation(String sftpHost, Integer sftpPort, String sftpPath) { - return SftpLocation.Builder.newInstance().host(sftpHost).port(sftpPort).path(sftpPath).build(); - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinition.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinition.java deleted file mode 100644 index 45c71eff3..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinition.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ResourceDefinition; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; - -public class SftpProviderResourceDefinition extends ResourceDefinition { - private final String providerType; - private final SftpDataAddress sftpDataAddress; - - public SftpProviderResourceDefinition(String providerType, SftpDataAddress sftpDataAddress) { - this.providerType = providerType; - this.sftpDataAddress = sftpDataAddress; - } - - - public String getProviderType() { - return providerType; - } - - public SftpDataAddress getSftpDataAddress() { - return sftpDataAddress; - } - - @Override - public > B toBuilder() { - return null; - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinitionGenerator.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinitionGenerator.java deleted file mode 100644 index 370b1054e..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinitionGenerator.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.edc.connector.controlplane.transfer.spi.provision.ProviderResourceDefinitionGenerator; -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ResourceDefinition; -import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess; -import org.eclipse.edc.policy.model.Policy; -import org.eclipse.edc.spi.types.domain.DataAddress; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.EdcSftpException; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.jetbrains.annotations.Nullable; - - -public class SftpProviderResourceDefinitionGenerator implements ProviderResourceDefinitionGenerator { - - @Override - public @Nullable ResourceDefinition generate(TransferProcess transferProcess, DataAddress assetAddress, Policy policy) { - try { - var sftpDataAddress = SftpDataAddress.fromDataAddress(assetAddress); - return new SftpProviderResourceDefinition(NoOpSftpProvisioner.PROVIDER_TYPE, sftpDataAddress); - } catch (EdcSftpException e) { - return null; - } - } - - @Override - public boolean canGenerate(TransferProcess transferProcess, DataAddress dataAddress, Policy policy) { - try { - SftpDataAddress.fromDataAddress(dataAddress); - } catch (EdcSftpException e) { - return false; - } - return true; - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionedContentResource.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionedContentResource.java deleted file mode 100644 index 2879252a7..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionedContentResource.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ProvisionedContentResource; -import org.eclipse.edc.policy.model.Policy; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; - -import java.util.Objects; - -public class SftpProvisionedContentResource extends ProvisionedContentResource { - private String providerType; - private Policy scopedPolicy; - private SftpDataAddress sftpDataAddress; - - private SftpProvisionedContentResource() { - - } - - public String getProviderType() { - return providerType; - } - - public Policy getScopedPolicy() { - return scopedPolicy; - } - - public String getProvisionedResourceId() { - return id; - } - - public SftpDataAddress getSftpDataAddress() { - return sftpDataAddress; - } - - - public static class Builder extends ProvisionedContentResource.Builder { - - protected Builder(SftpProvisionedContentResource resource) { - super(resource); - } - - public static Builder newInstance() { - return new Builder(new SftpProvisionedContentResource()); - } - - public Builder providerType(String providerType) { - this.provisionedResource.providerType = providerType; - return this; - } - - public Builder scopedPolicy(Policy scopedPolicy) { - provisionedResource.scopedPolicy = scopedPolicy; - return this; - } - - public Builder sftpDataAddress(SftpDataAddress dataAddress) { - dataAddress(dataAddress); - provisionedResource.sftpDataAddress = dataAddress; - return this; - } - - public Builder provisionedResourceId(String resourceId) { - id(resourceId); - - return this; - } - - public SftpProvisionedContentResource build() { - provisionedResource.dataAddress = dataAddressBuilder.build(); - Objects.requireNonNull(provisionedResource.providerType, "providerType"); - Objects.requireNonNull(provisionedResource.scopedPolicy, "scopedPolicy"); - Objects.requireNonNull(provisionedResource.sftpDataAddress, "dataAddress"); - return provisionedResource; - } - - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionerConfiguration.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionerConfiguration.java deleted file mode 100644 index d25c83039..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionerConfiguration.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Microsoft Corporation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import java.net.URL; - -/** - * Configuration to create a resource definition and provisioner pair for sftp data transfer. - */ -public class SftpProvisionerConfiguration { - - private String name; - - private final ProvisionerType provisionerType = ProvisionerType.PROVIDER; - - private String dataAddressType; - private String policyScope; - private URL endpoint; - - public enum ProvisionerType { - CONSUMER, - PROVIDER - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionerExtension.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionerExtension.java deleted file mode 100644 index b3d5c0a14..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProvisionerExtension.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.edc.connector.controlplane.transfer.spi.provision.ProviderResourceDefinitionGenerator; -import org.eclipse.edc.connector.controlplane.transfer.spi.provision.ProvisionManager; -import org.eclipse.edc.policy.engine.spi.PolicyEngine; -import org.eclipse.edc.runtime.metamodel.annotation.Inject; -import org.eclipse.edc.runtime.metamodel.annotation.Provides; -import org.eclipse.edc.spi.monitor.Monitor; -import org.eclipse.edc.spi.system.ServiceExtension; -import org.eclipse.edc.spi.system.ServiceExtensionContext; - -@Provides(NoOpSftpProvisioner.class) -public class SftpProvisionerExtension implements ServiceExtension { - - private static final String POLICY_SCOPE_CONFIG_PATH = "provisioner.sftp.policy.scope"; - private static final String DEFAULT_POLICY_SCOPE = "sftp.provisioner"; - @Inject - ProvisionManager provisionManager; - @Inject - Monitor monitor; - @Inject - PolicyEngine policyEngine; - - @Override - public String name() { - return "Sftp Provisioner"; - } - - @Override - public void initialize(ServiceExtensionContext context) { - var policyScope = context.getConfig().getString(POLICY_SCOPE_CONFIG_PATH, DEFAULT_POLICY_SCOPE); - - var sftpProvider = new NoOpSftpProvider(); - var noOpSftpProvisioner = new NoOpSftpProvisioner(policyScope, policyEngine, sftpProvider); - var generator = new SftpProviderResourceDefinitionGenerator(); - provisionManager.register(noOpSftpProvisioner); - context.registerService(ProviderResourceDefinitionGenerator.class, generator); - monitor.info("SftpProvisionerExtension: authentication/initialization complete."); - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpUserFactoryImpl.java b/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpUserFactoryImpl.java deleted file mode 100644 index b7c4e6952..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpUserFactoryImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUserFactory; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUserKeyPairGenerator; - -public class SftpUserFactoryImpl implements SftpUserFactory { - - @Override - public SftpUser createSftpUser(String sftpUserName, String sftpUserPassword, byte[] sftpUserPrivateKey) { - var sftpUserKeyPair = SftpUserKeyPairGenerator.getKeyPairFromPrivateKey(sftpUserPrivateKey, sftpUserName); - - return SftpUser.Builder.newInstance() - .name(sftpUserName) - .password(sftpUserPassword) - .keyPair(sftpUserKeyPair) - .build(); - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension b/edc-extensions/transferprocess-sftp-provisioner/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension deleted file mode 100644 index f17c7f783..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +++ /dev/null @@ -1,20 +0,0 @@ -################################################################################# -# Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# 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. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 -################################################################################# - - org.eclipse.tractusx.edc.transferprocess.sftp.provisioner.SftpProvisionerExtension diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvisionerTest.java b/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvisionerTest.java deleted file mode 100644 index 4fc772118..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/NoOpSftpProvisionerTest.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ProvisionedContentResource; -import org.eclipse.edc.connector.controlplane.transfer.spi.types.ResourceDefinition; -import org.eclipse.edc.policy.engine.spi.PolicyEngine; -import org.eclipse.edc.policy.model.Policy; -import org.eclipse.edc.spi.result.AbstractResult; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.util.UUID; -import java.util.concurrent.ExecutionException; - -import static java.time.Duration.ofSeconds; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -class NoOpSftpProvisionerTest { - private final String policyScope = "scope"; - private final PolicyEngine policyEngine = mock(PolicyEngine.class); - private final NoOpSftpProvider sftpProvider = new NoOpSftpProvider(); - - private final NoOpSftpProvisioner provisioner = - new NoOpSftpProvisioner(policyScope, policyEngine, sftpProvider); - - @Test - void canProvision_true() { - var provisionType = "NoOp"; - var sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - var sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var resourceDefinition = - new SftpProviderResourceDefinition(provisionType, dataAddress); - - Assertions.assertTrue(provisioner.canProvision(resourceDefinition)); - } - - @Test - void canProvision_falseProvisionType() { - var provisionType = "AmazonS3"; - SftpUser sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - SftpLocation sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var resourceDefinition = - new SftpProviderResourceDefinition(provisionType, dataAddress); - - Assertions.assertFalse(provisioner.canProvision(resourceDefinition)); - } - - @Test - void canProvision_falseDefinitionType() { - ResourceDefinition resourceDefinition = new WrongResourceDefinition(); - - Assertions.assertFalse(provisioner.canProvision(resourceDefinition)); - } - - @Test - void canDeprovision_true() { - var provisionType = "NoOp"; - var sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - var sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var scopedPolicy = mock(Policy.class); - var dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var provisionedResourceId = "resource"; - var provisionedContentResource = - SftpProvisionedContentResource.Builder.newInstance() - .providerType(provisionType) - .scopedPolicy(scopedPolicy) - .transferProcessId(UUID.randomUUID().toString()) - .resourceDefinitionId(UUID.randomUUID().toString()) - .resourceName("test-resource") - .provisionedResourceId("test-resdef-id") - .sftpDataAddress(dataAddress) - .provisionedResourceId(provisionedResourceId) - .build(); - - assertThat(provisioner.canDeprovision(provisionedContentResource)).isTrue(); - } - - @Test - void canDeprovision_falseProvisionType() { - var provisionType = "AmazonS3"; - SftpUser sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - SftpLocation sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var scopedPolicy = mock(Policy.class); - var dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var provisionedResourceId = "resource"; - var provisionedContentResource = - SftpProvisionedContentResource.Builder.newInstance() - .providerType(provisionType) - .scopedPolicy(scopedPolicy) - .transferProcessId(UUID.randomUUID().toString()) - .resourceDefinitionId(UUID.randomUUID().toString()) - .resourceName("test-resource") - .provisionedResourceId("test-resdef-id") - .sftpDataAddress(dataAddress).provisionedResourceId(provisionedResourceId) - .build(); - - Assertions.assertFalse(provisioner.canDeprovision(provisionedContentResource)); - } - - @Test - void canDeprovision_falseDefinitionType() { - ProvisionedContentResource provisionedContentResource = new WrongProvisionedContentResource(); - - Assertions.assertFalse(provisioner.canDeprovision(provisionedContentResource)); - } - - @Test - void provision_successful() throws ExecutionException, InterruptedException { - var provisionType = "NoOp"; - SftpUser sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - SftpLocation sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var dataAddress = SftpDataAddress.Builder.newInstance().type("sftp").sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var resourceDefinition = new SftpProviderResourceDefinition(provisionType, dataAddress); - var policy = mock(Policy.class); - - when(policyEngine.filter(policy, policyScope)).thenReturn(policy); - - var future = provisioner.provision(resourceDefinition, policy); - assertThat(future).succeedsWithin(ofSeconds(5)); - assertThat(future).isCompletedWithValueMatching(AbstractResult::succeeded); - } - - @Test - void provision_failedWrongProvisionType() { - var provisionType = "AmazonS3"; - SftpUser sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - SftpLocation sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var resourceDefinition = - new SftpProviderResourceDefinition(provisionType, dataAddress); - var policy = mock(Policy.class); - - when(policyEngine.filter(policy, policyScope)).thenReturn(policy); - - var future = - provisioner.provision(resourceDefinition, policy); - - assertThat(future).succeedsWithin(ofSeconds(5)); - assertThat(future).isCompletedWithValueMatching(AbstractResult::failed); - } - - @Test - void deprovision_successful() { - var provisionType = "NoOp"; - var sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - var sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var policy = mock(Policy.class); - var provisionedResourceId = "resource"; - var provisionedContentResource = SftpProvisionedContentResource.Builder.newInstance() - .providerType(provisionType) - .scopedPolicy(policy) - .sftpDataAddress(dataAddress) - .provisionedResourceId(provisionedResourceId) - .transferProcessId(UUID.randomUUID().toString()) - .resourceDefinitionId(UUID.randomUUID().toString()) - .resourceName("test-resource") - .provisionedResourceId("test-resdef-id") - .build(); - var future = provisioner.deprovision(provisionedContentResource, policy); - - assertThat(future).succeedsWithin(ofSeconds(5)); - assertThat(future).isCompletedWithValueMatching(AbstractResult::succeeded); - - } - - @Test - void deprovision_failedWrongProvisionType() { - var provisionType = "AmazonS3"; - var sftpUser = SftpUser.Builder.newInstance().name("name").password("password").build(); - var sftpLocation = SftpLocation.Builder.newInstance().host("host").port(22).path("path").build(); - var dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var policy = mock(Policy.class); - var provisionedResourceId = "resource"; - var provisionedContentResource = - SftpProvisionedContentResource.Builder.newInstance() - .providerType(provisionType) - .scopedPolicy(policy) - .sftpDataAddress(dataAddress).provisionedResourceId(provisionedResourceId) - .transferProcessId(UUID.randomUUID().toString()) - .resourceDefinitionId(UUID.randomUUID().toString()) - .resourceName("test-resource") - .provisionedResourceId("test-resdef-id") - .build(); - - var future = - provisioner.deprovision(provisionedContentResource, policy); - assertThat(future).isCompletedWithValueMatching(AbstractResult::failed); - } - - private static class WrongResourceDefinition extends ResourceDefinition { - @Override - public > B toBuilder() { - return null; - } - } - - private static class WrongProvisionedContentResource extends ProvisionedContentResource { - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpLocationFactoryImplTest.java b/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpLocationFactoryImplTest.java deleted file mode 100644 index e82f65bf3..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpLocationFactoryImplTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -class SftpLocationFactoryImplTest { - private final SftpLocationFactoryImpl sftpLocationFactoryImpl = new SftpLocationFactoryImpl(); - - @Test - void generateSftpLocation() { - final String host = "host"; - final Integer port = 22; - final String path = "path"; - - final SftpLocation location = sftpLocationFactoryImpl.createSftpLocation(host, port, path); - - Assertions.assertEquals(host, location.getHost()); - Assertions.assertEquals(port, location.getPort()); - Assertions.assertEquals(path, location.getPath()); - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinitionGeneratorTest.java b/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinitionGeneratorTest.java deleted file mode 100644 index 1e2de4965..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpProviderResourceDefinitionGeneratorTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - - -import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess; -import org.eclipse.edc.policy.model.Policy; -import org.eclipse.edc.spi.types.domain.DataAddress; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpDataAddress; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpLocation; -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Test; - -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; - -import static org.eclipse.tractusx.edc.transferprocess.sftp.provisioner.NoOpSftpProvisioner.PROVIDER_TYPE; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; - - -class SftpProviderResourceDefinitionGeneratorTest { - private final SftpProviderResourceDefinitionGenerator generator = - new SftpProviderResourceDefinitionGenerator(); - - static KeyPair generateKeyPair() { - try { - var keyPairGenerator = KeyPairGenerator.getInstance("RSA"); - keyPairGenerator.initialize(2048); - return keyPairGenerator.generateKeyPair(); - } catch (NoSuchAlgorithmException e) { - throw new AssertionError(e); - } - } - - @Test - void generate_successful() throws NoSuchAlgorithmException { - var name = "name"; - var password = "password"; - var keyPair = generateKeyPair(); - var host = "host"; - var port = 22; - var path = "path"; - - var sftpUser = SftpUser.Builder.newInstance().name(name).password(password).keyPair(keyPair).build(); - var sftpLocation = - SftpLocation.Builder.newInstance().host(host).port(port).path(path).build(); - final DataAddress dataAddress = SftpDataAddress.Builder.newInstance().sftpUser(sftpUser).sftpLocation(sftpLocation).build(); - var policy = Policy.Builder.newInstance().build(); - - var transferProcess = TransferProcess.Builder.newInstance().build(); - var resourceDefinition = - (SftpProviderResourceDefinition) generator.generate(transferProcess, dataAddress, policy); - - assertNotNull(resourceDefinition); - var sftpDataAddress = resourceDefinition.getSftpDataAddress(); - - assertEquals(PROVIDER_TYPE, resourceDefinition.getProviderType()); - assertEquals(host, sftpDataAddress.getSftpLocation().getHost()); - assertEquals(port, sftpDataAddress.getSftpLocation().getPort()); - assertEquals(path, sftpDataAddress.getSftpLocation().getPath()); - assertEquals(name, sftpDataAddress.getSftpUser().getName()); - assertEquals(password, sftpDataAddress.getSftpUser().getPassword()); - - } - - @Test - void generate_wrongDataAddressType() { - var dataAddress = DataAddress.Builder.newInstance().type("wrong").build(); - var policy = Policy.Builder.newInstance().build(); - - var transferProcess = TransferProcess.Builder.newInstance().build(); - - var resourceDefinition = - (SftpProviderResourceDefinition) generator.generate(transferProcess, dataAddress, policy); - - assertNull(resourceDefinition); - } -} diff --git a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpUserFactoryImplTest.java b/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpUserFactoryImplTest.java deleted file mode 100644 index 99e33d75e..000000000 --- a/edc-extensions/transferprocess-sftp-provisioner/src/test/java/org/eclipse/tractusx/edc/transferprocess/sftp/provisioner/SftpUserFactoryImplTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022 Mercedes-Benz Tech Innovation GmbH - * Copyright (c) 2021,2022 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -package org.eclipse.tractusx.edc.transferprocess.sftp.provisioner; - -import org.eclipse.tractusx.edc.transferprocess.sftp.common.SftpUser; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; - -class SftpUserFactoryImplTest { - private final SftpUserFactoryImpl sftpUserFactoryImpl = new SftpUserFactoryImpl(); - - @Test - void generateSftpLocation() throws NoSuchAlgorithmException { - final String name = "name"; - final String password = "password"; - - final KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); - keyPairGenerator.initialize(2048); - final KeyPair keyPair = keyPairGenerator.generateKeyPair(); - final byte[] privateKeyBytes = keyPair.getPrivate().getEncoded(); - - final SftpUser sftpUser = sftpUserFactoryImpl.createSftpUser(name, password, privateKeyBytes); - - Assertions.assertEquals(name, sftpUser.getName()); - Assertions.assertEquals(password, sftpUser.getPassword()); - - Assertions.assertArrayEquals(privateKeyBytes, sftpUser.getKeyPair().getPrivate().getEncoded()); - } -} diff --git a/edc-tests/e2e-tests/src/test/resources/summary-vc-no-dismantler.json b/edc-tests/e2e-tests/src/test/resources/summary-vc-no-dismantler.json deleted file mode 100644 index 750648f04..000000000 --- a/edc-tests/e2e-tests/src/test/resources/summary-vc-no-dismantler.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/2023/catenax/credentials/summary/v1" - ], - "id": "urn:uuid:12345678-1234-1234-1234-123456789abc", - "type": [ - "VerifiableCredential", - "SummaryCredential" - ], - "issuer": "did:web:example.com", - "issuanceDate": "2023-06-02T12:00:00Z", - "expirationDate": "2022-06-16T18:56:59Z", - "credentialSubject": { - "id": "did:web:example.com", - "holderIdentifier": "%s", - "type": "Summary-List", - "name": "CX-Credentials", - "items": [ - "MembershipCredential", - "PcfCredential", - "SustainabilityCredential", - "QualityCredential", - "TraceabilityCredential", - "BehaviorTwinCredential", - "BpnCredential" - ], - "contractTemplates": "https://public.catena-x.org/contracts/" - }, - "proof": { - "type": "Ed25519Signature2018", - "created": "2023-06-02T12:00:00Z", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:web:example.com#key-1", - "jws": "xxxx" - } -} \ No newline at end of file diff --git a/edc-tests/e2e-tests/src/test/resources/summary-vc.json b/edc-tests/e2e-tests/src/test/resources/summary-vc.json deleted file mode 100644 index 01c640a70..000000000 --- a/edc-tests/e2e-tests/src/test/resources/summary-vc.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://w3id.org/2023/catenax/credentials/summary/v1" - ], - "id": "urn:uuid:12345678-1234-1234-1234-123456789abc", - "type": [ - "VerifiableCredential", - "SummaryCredential" - ], - "issuer": "did:web:example.com", - "issuanceDate": "2023-06-02T12:00:00Z", - "expirationDate": "2022-06-16T18:56:59Z", - "credentialSubject": { - "id": "did:web:example.com", - "holderIdentifier": "%s", - "type": "Summary-List", - "name": "CX-Credentials", - "items": [ - "MembershipCredential", - "DismantlerCredential", - "PcfCredential", - "SustainabilityCredential", - "QualityCredential", - "TraceabilityCredential", - "BehaviorTwinCredential", - "BpnCredential" - ], - "contractTemplates": "https://public.catena-x.org/contracts/" - }, - "proof": { - "type": "Ed25519Signature2018", - "created": "2023-06-02T12:00:00Z", - "proofPurpose": "assertionMethod", - "verificationMethod": "did:web:example.com#key-1", - "jws": "xxxx" - } -} \ No newline at end of file diff --git a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/MockBpnIdentityService.java b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/MockBpnIdentityService.java index c95d7297a..6c01c8d0c 100644 --- a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/MockBpnIdentityService.java +++ b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/MockBpnIdentityService.java @@ -19,6 +19,7 @@ package org.eclipse.tractusx.edc.tests; +import org.eclipse.edc.json.JacksonTypeManager; import org.eclipse.edc.spi.iam.ClaimToken; import org.eclipse.edc.spi.iam.IdentityService; import org.eclipse.edc.spi.iam.TokenParameters; @@ -39,7 +40,7 @@ public class MockBpnIdentityService implements IdentityService { private static final String BUSINESS_PARTNER_NUMBER_CLAIM = "BusinessPartnerNumber"; private final String businessPartnerNumber; - private final TypeManager typeManager = new TypeManager(); + private final TypeManager typeManager = new JacksonTypeManager(); public MockBpnIdentityService(String businessPartnerNumber) { this.businessPartnerNumber = businessPartnerNumber; diff --git a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/ParticipantConsumerDataPlaneApi.java b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/ParticipantConsumerDataPlaneApi.java new file mode 100644 index 000000000..d32a0b1ad --- /dev/null +++ b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/ParticipantConsumerDataPlaneApi.java @@ -0,0 +1,54 @@ +/******************************************************************************** + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * 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. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +package org.eclipse.tractusx.edc.tests; + +import io.restassured.http.ContentType; +import org.eclipse.edc.connector.controlplane.test.system.utils.Participant; + +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; + + +/** + * E2E test helper for fetching the data + */ +public class ParticipantConsumerDataPlaneApi { + + + private final Participant.Endpoint dataPlaneProxy; + + public ParticipantConsumerDataPlaneApi(Participant.Endpoint dataPlaneProxy) { + + this.dataPlaneProxy = dataPlaneProxy; + } + + + public String pullData(Map body) { + var response = dataPlaneProxy.baseRequest() + .body(body) + .contentType(ContentType.JSON) + .post("/proxy/aas/request"); + + assertThat(response.statusCode()).isBetween(200, 300); + return response.body().asString(); + } + +} diff --git a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxIatpParticipantBase.java b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxIatpParticipantBase.java index 175a8fa2a..462ec1738 100644 --- a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxIatpParticipantBase.java +++ b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxIatpParticipantBase.java @@ -43,7 +43,7 @@ public Map iatpConfiguration(TractusxIatpParticipantBase... othe put("edc.iam.sts.oauth.token.url", stsUri + "/token"); put("edc.iam.sts.oauth.client.id", stsClientId); put("edc.iam.sts.oauth.client.secret.alias", "client_secret_alias"); - put("edc.ih.iam.id", getBpn()); + put("edc.ih.iam.id", getDid()); put("tx.vault.seed.secrets", "client_secret_alias:%s".formatted(stsClientSecret)); put("edc.ih.iam.publickey.alias", getFullKeyId()); put("edc.agent.identity.key", "client_id"); diff --git a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxParticipantBase.java b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxParticipantBase.java index 6977e33a1..71d7fa868 100644 --- a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxParticipantBase.java +++ b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/participant/TractusxParticipantBase.java @@ -19,9 +19,11 @@ package org.eclipse.tractusx.edc.tests.participant; +import io.restassured.response.ValidatableResponse; import jakarta.json.Json; import org.eclipse.edc.connector.controlplane.test.system.utils.Participant; import org.eclipse.tractusx.edc.tests.IdentityParticipant; +import org.eclipse.tractusx.edc.tests.ParticipantConsumerDataPlaneApi; import org.eclipse.tractusx.edc.tests.ParticipantDataApi; import org.eclipse.tractusx.edc.tests.ParticipantEdrApi; import org.jetbrains.annotations.NotNull; @@ -35,7 +37,11 @@ import static io.restassured.http.ContentType.JSON; import static jakarta.json.Json.createObjectBuilder; import static java.time.Duration.ofSeconds; +import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.CONTEXT; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; +import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; +import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.VOCAB; +import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; import static org.eclipse.edc.util.io.Ports.getFreePort; import static org.eclipse.tractusx.edc.edr.spi.CoreConstants.TX_NAMESPACE; @@ -47,14 +53,16 @@ public abstract class TractusxParticipantBase extends IdentityParticipant { public static final String API_KEY = "testkey"; public static final Duration ASYNC_TIMEOUT = ofSeconds(60); public static final Duration ASYNC_POLL_INTERVAL = ofSeconds(1); + protected final URI dataPlaneProxy = URI.create("http://localhost:" + getFreePort()); private final URI controlPlaneDefault = URI.create("http://localhost:" + getFreePort()); private final URI controlPlaneControl = URI.create("http://localhost:" + getFreePort() + "/control"); private final URI backendProviderProxy = URI.create("http://localhost:" + getFreePort() + "/events"); - private final URI dataPlaneProxy = URI.create("http://localhost:" + getFreePort()); private final URI dataPlanePublic = URI.create("http://localhost:" + getFreePort() + "/public"); protected ParticipantEdrApi edrs; protected ParticipantDataApi data; + protected ParticipantConsumerDataPlaneApi dataPlane; + protected String did; public void createAsset(String id) { @@ -121,6 +129,14 @@ public ParticipantDataApi data() { return data; } + + /** + * Returns the consumer data plane api for fetching data via consumer proxy + */ + public ParticipantConsumerDataPlaneApi dataPlane() { + return dataPlane; + } + /** * Stores BPN groups */ @@ -148,6 +164,24 @@ public String getDid() { return did; } + public ValidatableResponse getCatalog(TractusxParticipantBase provider) { + var requestBodyBuilder = createObjectBuilder() + .add(CONTEXT, createObjectBuilder().add(VOCAB, EDC_NAMESPACE)) + .add(TYPE, "CatalogRequest") + .add("counterPartyId", provider.id) + .add("counterPartyAddress", provider.protocolEndpoint.getUrl().toString()) + .add("protocol", protocol); + + + return managementEndpoint.baseRequest() + .contentType(JSON) + .when() + .body(requestBodyBuilder.build()) + .post("/v2/catalog/request") + .then(); + + } + public static class Builder

> extends Participant.Builder { protected Builder(P participant) { @@ -172,6 +206,7 @@ public TractusxParticipantBase build() { this.participant.edrs = new ParticipantEdrApi(participant); this.participant.data = new ParticipantDataApi(); + this.participant.dataPlane = new ParticipantConsumerDataPlaneApi(new Endpoint(this.participant.dataPlaneProxy, Map.of("x-api-key", API_KEY))); return participant; } } diff --git a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullBaseTest.java b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullBaseTest.java index 9a35f7f2e..5dbf15b60 100644 --- a/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullBaseTest.java +++ b/edc-tests/edc-controlplane/fixtures/src/testFixtures/java/org/eclipse/tractusx/edc/tests/transfer/HttpConsumerPullBaseTest.java @@ -106,9 +106,60 @@ void transferData_privateBackend() { .withHeader("Edc-Contract-Agreement-Id") .withHeader("Edc-Bpn", sokrates().getBpn()) .withMethod("GET"), VerificationTimes.exactly(1)); + + } + + + @Test + void transferData_privateBackend_withConsumerDataPlane() { + var assetId = "api-asset-1"; + + + Map dataAddress = Map.of( + "baseUrl", privateBackendUrl, + "type", "HttpData", + "contentType", "application/json" + ); + plato().createAsset(assetId, Map.of(), dataAddress); + + var accessPolicyId = plato().createPolicyDefinition(createAccessPolicy(sokrates().getBpn())); + var contractPolicyId = plato().createPolicyDefinition(createContractPolicy(sokrates().getBpn())); + plato().createContractDefinition(assetId, "def-1", accessPolicyId, contractPolicyId); + var transferProcessId = sokrates().requestAsset(plato(), assetId, Json.createObjectBuilder().build(), createProxyRequest(), "HttpData-PULL"); + + var edr = new AtomicReference(); + + // wait until transfer process completes + await().pollInterval(fibonacci()) + .atMost(ASYNC_TIMEOUT) + .untilAsserted(() -> { + var tpState = sokrates().getTransferProcessState(transferProcessId); + assertThat(tpState).isNotNull().isEqualTo(TransferProcessStates.STARTED.toString()); + }); + + // wait until EDC is available on the consumer side + server.when(request().withMethod("GET").withPath(MOCK_BACKEND_PATH)).respond(response().withStatusCode(200).withBody("test response")); + await().pollInterval(fibonacci()) + .atMost(ASYNC_TIMEOUT) + .untilAsserted(() -> { + edr.set(sokrates().edrs().getEdr(transferProcessId)); + assertThat(edr).isNotNull(); + }); + + + // pull data out of provider's backend service: + //Consumer-DP -> Prov-DP -> Prov-backend + assertThat(sokrates().dataPlane().pullData(Map.of("transferProcessId", transferProcessId))).isEqualTo("test response"); + + server.verify(request() + .withPath(MOCK_BACKEND_PATH) + .withHeader("Edc-Contract-Agreement-Id") + .withHeader("Edc-Bpn", sokrates().getBpn()) + .withMethod("GET"), VerificationTimes.exactly(1)); } + @AfterEach void teardown() { server.stop(); diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/AbstractIatpConsumerPullTest.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/AbstractIatpConsumerPullTest.java index ef0446bd1..0d65bb858 100644 --- a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/AbstractIatpConsumerPullTest.java +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/AbstractIatpConsumerPullTest.java @@ -22,12 +22,24 @@ import jakarta.json.Json; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcessStates; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialFormat; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialStatus; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.VerifiableCredential; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.VerifiableCredentialContainer; +import org.eclipse.edc.identityhub.spi.model.VerifiableCredentialResource; +import org.eclipse.edc.identityhub.spi.store.CredentialStore; +import org.eclipse.edc.jsonld.spi.JsonLd; import org.eclipse.edc.policy.model.Operator; +import org.eclipse.edc.spi.query.Criterion; +import org.eclipse.edc.spi.query.QuerySpec; import org.eclipse.tractusx.edc.tests.participant.TractusxParticipantBase; import org.eclipse.tractusx.edc.tests.transfer.iatp.harness.DataspaceIssuer; import org.eclipse.tractusx.edc.tests.transfer.iatp.harness.IatpParticipant; +import org.eclipse.tractusx.edc.tests.transfer.iatp.harness.StatusList2021; import org.eclipse.tractusx.edc.tests.transfer.iatp.harness.StsParticipant; +import org.eclipse.tractusx.edc.tests.transfer.iatp.runtime.IatpParticipantRuntime; import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -35,8 +47,9 @@ import org.junit.jupiter.params.provider.ArgumentsSource; import org.mockserver.verify.VerificationTimes; -import java.io.IOException; import java.net.URI; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; @@ -55,6 +68,10 @@ import static org.eclipse.tractusx.edc.tests.helpers.PolicyHelperFunctions.frameworkPolicy; import static org.eclipse.tractusx.edc.tests.helpers.TransferProcessHelperFunctions.createProxyRequest; import static org.eclipse.tractusx.edc.tests.participant.TractusxParticipantBase.ASYNC_TIMEOUT; +import static org.eclipse.tractusx.edc.tests.transfer.iatp.harness.IatpHelperFunctions.createVcBuilder; +import static org.eclipse.tractusx.edc.tests.transfer.iatp.harness.IatpHelperFunctions.membershipSubject; +import static org.hamcrest.Matchers.not; +import static org.mockserver.integration.ClientAndServer.startClientAndServer; import static org.mockserver.model.HttpRequest.request; import static org.mockserver.model.HttpResponse.response; @@ -102,7 +119,6 @@ public TractusxParticipantBase sokrates() { return SOKRATES; } - @DisplayName("Contract policy is fulfilled") @ParameterizedTest(name = "{1}") @ArgumentsSource(ValidContractPolicyProvider.class) @@ -160,7 +176,7 @@ void transferData_whenContractPolicyFulfilled(JsonObject contractPolicy, String @DisplayName("Contract policy is NOT fulfilled") @ParameterizedTest(name = "{1}") @ArgumentsSource(InvalidContractPolicyProvider.class) - void transferData_whenContractPolicyNotFulfilled(JsonObject contractPolicy, String description) throws IOException { + void transferData_whenContractPolicyNotFulfilled(JsonObject contractPolicy, String description) { var assetId = "api-asset-1"; var authCodeHeaderName = "test-authkey"; @@ -189,11 +205,130 @@ void transferData_whenContractPolicyNotFulfilled(JsonObject contractPolicy, Stri }); } + @DisplayName("Expect the Catalog request to fail if a credential is expired") + @Test + void catalogRequest_whenCredentialExpired() { + //update the membership credential to an expirationDate that is in the past + var store = sokratesRuntime().getService(CredentialStore.class); + var jsonLd = sokratesRuntime().getService(JsonLd.class); + + var existingCred = store.query(QuerySpec.Builder.newInstance().filter(new Criterion("verifiableCredential.credential.type", "contains", "MembershipCredential")).build()) + .orElseThrow(f -> new RuntimeException(f.getFailureDetail())) + .stream().findFirst() + .orElseThrow(RuntimeException::new); + + var expirationDate = Instant.now().minus(1, ChronoUnit.DAYS); + var newCred = VerifiableCredential.Builder.newInstance() + .id(existingCred.getVerifiableCredential().credential().getId()) + .types(existingCred.getVerifiableCredential().credential().getType()) + .credentialSubjects(existingCred.getVerifiableCredential().credential().getCredentialSubject()) + .issuer(existingCred.getVerifiableCredential().credential().getIssuer()) + .issuanceDate(existingCred.getVerifiableCredential().credential().getIssuanceDate()) + .expirationDate(expirationDate) + .build(); + + var did = SOKRATES.getDid(); + var bpn = SOKRATES.getBpn(); + var newRawVc = createVcBuilder(DATASPACE_ISSUER_PARTICIPANT.didUrl(), "MembershipCredential", membershipSubject(did, bpn)); + newRawVc.add("expirationDate", expirationDate.toString()); + + var newVcString = DATASPACE_ISSUER_PARTICIPANT.createLdpVc(jsonLd, newRawVc.build()); + + store.update(VerifiableCredentialResource.Builder.newInstance() + .id(existingCred.getId()) + .issuerId(DATASPACE_ISSUER_PARTICIPANT.didUrl()) + .participantId(did) + .holderId(bpn) + .credential(new VerifiableCredentialContainer(newVcString, CredentialFormat.JSON_LD, newCred)) + .build()) + .orElseThrow(f -> new RuntimeException(f.getFailureDetail())); + + + // verify the failed catalog request + try { + SOKRATES.getCatalog(PLATO) + .log().ifError() + .statusCode(not(200)); + } finally { + // restore the non-expired cred + store.update(existingCred); + } + } + + @DisplayName("Expect the Catalog request to fail if a credential is revoked") + @Test + void catalogRequest_whenCredentialRevoked() { + //update the membership credential to contain a `credentialStatus` with a revocation + var store = sokratesRuntime().getService(CredentialStore.class); + var jsonLd = sokratesRuntime().getService(JsonLd.class); + var port = getFreePort(); + + var existingCred = store.query(QuerySpec.Builder.newInstance().filter(new Criterion("verifiableCredential.credential.type", "contains", "MembershipCredential")).build()) + .orElseThrow(f -> new RuntimeException(f.getFailureDetail())) + .stream().findFirst() + .orElseThrow(RuntimeException::new); + + var newCred = VerifiableCredential.Builder.newInstance() + .id(existingCred.getVerifiableCredential().credential().getId()) + .types(existingCred.getVerifiableCredential().credential().getType()) + .credentialSubjects(existingCred.getVerifiableCredential().credential().getCredentialSubject()) + .credentialStatus(new CredentialStatus("https://localhost:%s/status/list/7#12345".formatted(port), "StatusList2021", + Map.of("statusPurpose", "revocation", + "statusListIndex", "12345", + "statusListCredential", "https://localhost:%d/status/list/7".formatted(port) + ) + )) + .issuer(existingCred.getVerifiableCredential().credential().getIssuer()) + .issuanceDate(existingCred.getVerifiableCredential().credential().getIssuanceDate()) + .build(); + + var did = SOKRATES.getDid(); + var bpn = SOKRATES.getBpn(); + var newRawVc = createVcBuilder(DATASPACE_ISSUER_PARTICIPANT.didUrl(), "MembershipCredential", membershipSubject(did, bpn)); + newRawVc.add("credentialStatus", Json.createObjectBuilder() + .add("id", "http://localhost:%d/status/list/7#12345".formatted(port)) + .add("type", "StatusList2021Entry") + .add("statusPurpose", "revocation") + .add("statusListIndex", "12345") + .add("statusListCredential", "http://localhost:%d/status/list/7".formatted(port)) + .build()); + + var newVcString = DATASPACE_ISSUER_PARTICIPANT.createLdpVc(jsonLd, newRawVc.build()); + + store.update(VerifiableCredentialResource.Builder.newInstance() + .id(existingCred.getId()) + .issuerId(DATASPACE_ISSUER_PARTICIPANT.didUrl()) + .participantId(did) + .holderId(bpn) + .credential(new VerifiableCredentialContainer(newVcString, CredentialFormat.JSON_LD, newCred)) + .build()) + .orElseThrow(f -> new RuntimeException(f.getFailureDetail())); + + // return a StatusListCredential, where the credential's status is "revocation" + try (var revocationServer = startClientAndServer(port)) { + var slCred = StatusList2021.create(DATASPACE_ISSUER_PARTICIPANT.didUrl(), "revocation") + .withStatus(12345, true); + revocationServer.when(request().withPath("/status/list/7")).respond(response().withBody(slCred.toJsonObject().toString())); + + // verify the failed catalog request + SOKRATES.getCatalog(PLATO) + .log().ifValidationFails() + .statusCode(not(200)); + } finally { + // restore the original credential without credentialStatus + store.update(existingCred); + } + } + @Override protected JsonObject createContractPolicy(String bpn) { return frameworkPolicy(Map.of(CX_CREDENTIAL_NS + "Membership", "active")); } + protected abstract IatpParticipantRuntime sokratesRuntime(); + + protected abstract IatpParticipantRuntime platoRuntime(); + private static class ValidContractPolicyProvider implements ArgumentsProvider { @Override public Stream provideArguments(ExtensionContext extensionContext) { @@ -224,5 +359,4 @@ public Stream provideArguments(ExtensionContext extensionCo ); } } - } diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/DimHttpConsumerPullTest.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/DimHttpConsumerPullTest.java index 90b9c2e4d..750681610 100644 --- a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/DimHttpConsumerPullTest.java +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/DimHttpConsumerPullTest.java @@ -101,5 +101,13 @@ private static Supplier publicIdSupplier(IatpParticipant participant) { return participant::verificationId; } + @Override + protected IatpParticipantRuntime sokratesRuntime() { + return SOKRATES_RUNTIME; + } + @Override + protected IatpParticipantRuntime platoRuntime() { + return SOKRATES_RUNTIME; + } } diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/StsHttpConsumerPullTest.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/StsHttpConsumerPullTest.java index 4ec46af14..69f1905e2 100644 --- a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/StsHttpConsumerPullTest.java +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/StsHttpConsumerPullTest.java @@ -58,4 +58,13 @@ static void prepare() { } + @Override + protected IatpParticipantRuntime sokratesRuntime() { + return SOKRATES_RUNTIME; + } + + @Override + protected IatpParticipantRuntime platoRuntime() { + return PLATO_RUNTIME; + } } diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/DimDispatcher.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/DimDispatcher.java index be30b6022..06cec1a77 100644 --- a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/DimDispatcher.java +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/DimDispatcher.java @@ -23,6 +23,7 @@ import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.RecordedRequest; import org.eclipse.edc.iam.identitytrust.sts.embedded.EmbeddedSecureTokenService; +import org.eclipse.edc.json.JacksonTypeManager; import org.eclipse.edc.spi.iam.TokenRepresentation; import org.eclipse.edc.spi.types.TypeManager; import org.jetbrains.annotations.NotNull; @@ -42,7 +43,7 @@ */ public class DimDispatcher extends Dispatcher { - private static final TypeManager MAPPER = new TypeManager(); + private static final TypeManager MAPPER = new JacksonTypeManager(); private final String path; private final Map secureTokenServices; diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/KeycloakDispatcher.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/KeycloakDispatcher.java index 6861f3a30..c191073d3 100644 --- a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/KeycloakDispatcher.java +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/dispatchers/KeycloakDispatcher.java @@ -22,6 +22,7 @@ import okhttp3.mockwebserver.Dispatcher; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.RecordedRequest; +import org.eclipse.edc.json.JacksonTypeManager; import org.eclipse.edc.spi.types.TypeManager; import org.jetbrains.annotations.NotNull; @@ -29,7 +30,7 @@ public class KeycloakDispatcher extends Dispatcher { - private static final TypeManager MAPPER = new TypeManager(); + private static final TypeManager MAPPER = new JacksonTypeManager(); private final String path; public KeycloakDispatcher(String path) { diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/DataspaceIssuer.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/DataspaceIssuer.java index 6a03cd8eb..d9e645529 100644 --- a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/DataspaceIssuer.java +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/DataspaceIssuer.java @@ -77,7 +77,7 @@ public String verificationId() { return DATASPACE_ISSUER + "#" + getKeyId(); } - public VerifiableCredentialResource issueCredential(String did, String bpn, JsonLd jsonLd, String type, Supplier credentialSubjectSupplier, Supplier subjectSupplier) { + public VerifiableCredentialResource issueCredential(String did, String bpn, JsonLd jsonLd, String type, Supplier credentialSubjectSupplier, JsonObject subjectSupplier) { var credential = VerifiableCredential.Builder.newInstance() .type(type) .credentialSubject(credentialSubjectSupplier.get()) @@ -85,7 +85,8 @@ public VerifiableCredentialResource issueCredential(String did, String bpn, Json .issuanceDate(Instant.now()) .build(); - var rawVc = createLdpVc(jsonLd, type, subjectSupplier); + var vcJson = createVc(didUrl(), type, subjectSupplier); + var rawVc = createLdpVc(jsonLd, vcJson); return VerifiableCredentialResource.Builder.newInstance() .issuerId(didUrl()) .participantId(did) @@ -99,16 +100,17 @@ public VerifiableCredentialResource issueMembershipCredential(String did, String return issueCredential(did, bpn, jsonLd, "MembershipCredential", () -> CredentialSubject.Builder.newInstance() .claim("holderIdentifier", bpn) .build(), - () -> membershipSubject(did, bpn)); + membershipSubject(did, bpn)); } public VerifiableCredentialResource issueDismantlerCredential(String did, String bpn, JsonLd jsonLd) { return issueCredential(did, bpn, jsonLd, "DismantlerCredential", () -> CredentialSubject.Builder.newInstance() + .id(did) .claim("holderIdentifier", bpn) .claim("activityType", "vehicleDismantle") .claim("allowedVehicleBrands", List.of("Moskvich", "Lada")) .build(), - () -> Json.createObjectBuilder() + Json.createObjectBuilder() .add("type", "DismantlerCredential") .add("holderIdentifier", bpn) .add("activityType", "vehicleDismantle") @@ -121,7 +123,7 @@ public VerifiableCredentialResource issueFrameworkCredential(String did, String return issueCredential(did, bpn, jsonLd, credentialType, () -> CredentialSubject.Builder.newInstance() .claim("holderIdentifier", bpn) .build(), - () -> frameworkAgreementSubject(did, bpn, credentialType)); + frameworkAgreementSubject(did, bpn, credentialType)); } @@ -130,7 +132,7 @@ public String getFullKeyId() { return verificationId(); } - private String createLdpVc(JsonLd jsonLd, String type, Supplier subjectSupplier) { + public String createLdpVc(JsonLd jsonLd, JsonObject verifiableCredential) { var issuer = LdpIssuer.Builder.newInstance() .jsonLd(jsonLd) .monitor(mock()) @@ -143,8 +145,7 @@ private String createLdpVc(JsonLd jsonLd, String type, Supplier subj var key = getKeyPairAsJwk(); - var vc = createVc(didUrl(), type, subjectSupplier); - var result = issuer.signDocument(vc, createKeyPair(key, verificationId()), proofOptions).orElseThrow(err -> new RuntimeException(err.getFailureDetail())); + var result = issuer.signDocument(verifiableCredential, createKeyPair(key, verificationId()), proofOptions).orElseThrow(err -> new RuntimeException(err.getFailureDetail())); try { return MAPPER.writeValueAsString(result); diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/IatpHelperFunctions.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/IatpHelperFunctions.java index 36485819d..f38d6b265 100644 --- a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/IatpHelperFunctions.java +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/IatpHelperFunctions.java @@ -22,6 +22,7 @@ import jakarta.json.Json; import jakarta.json.JsonArray; import jakarta.json.JsonObject; +import jakarta.json.JsonObjectBuilder; import org.eclipse.edc.iam.did.spi.document.DidDocument; import org.eclipse.edc.iam.did.spi.resolution.DidResolverRegistry; import org.eclipse.edc.identityhub.spi.ParticipantContextService; @@ -36,17 +37,20 @@ import java.time.Instant; import java.util.List; import java.util.Map; -import java.util.function.Supplier; public class IatpHelperFunctions { - public static JsonObject createVc(String issuer, String type, Supplier subjectSupplier) { + public static JsonObject createVc(String issuer, String type, JsonObject subjectSupplier) { + return createVcBuilder(issuer, type, subjectSupplier) + .build(); + } + + public static JsonObjectBuilder createVcBuilder(String issuer, String type, JsonObject subjectSupplier) { return Json.createObjectBuilder() .add("@context", context()) .add("type", types(type)) - .add("credentialSubject", subjectSupplier.get()) + .add("credentialSubject", subjectSupplier) .add("issuer", issuer) - .add("issuanceDate", Instant.now().toString()) - .build(); + .add("issuanceDate", Instant.now().toString()); } public static JsonObject membershipSubject(String did, String id) { @@ -81,6 +85,7 @@ private static JsonArray context() { .add("https://www.w3.org/2018/credentials/v1") .add("https://w3id.org/security/suites/jws-2020/v1") .add("https://w3id.org/catenax/credentials") + .add("https://w3id.org/vc/status-list/2021/v1") .build(); } diff --git a/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/StatusList2021.java b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/StatusList2021.java new file mode 100644 index 000000000..172d513b8 --- /dev/null +++ b/edc-tests/edc-controlplane/iatp-tests/src/test/java/org/eclipse/tractusx/edc/tests/transfer/iatp/harness/StatusList2021.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * 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. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.eclipse.tractusx.edc.tests.transfer.iatp.harness; + +import jakarta.json.Json; +import jakarta.json.JsonObject; +import org.eclipse.edc.iam.verifiablecredentials.spi.model.statuslist.BitString; +import org.eclipse.edc.spi.EdcException; + +import java.util.List; + +import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.CONTEXT; + +public class StatusList2021 { + private final BitString bitString = BitString.Builder.newInstance().size(16 * 1024 * 8).build(); //minimum size is 16KB + private final String issuer; + private final String purpose; + + public StatusList2021(String issuer, String purpose) { + this.issuer = issuer; + this.purpose = purpose; + } + + public static StatusList2021 create(String issuer, String purpose) { + return new StatusList2021(issuer, purpose); + } + + public StatusList2021 withStatus(int index, boolean status) { + bitString.set(index, status); + return this; + } + + public JsonObject toJsonObject() { + return Json.createObjectBuilder() + .add(CONTEXT, Json.createArrayBuilder() + .add("https://www.w3.org/2018/credentials/v1") + .add("https://w3id.org/vc/status-list/2021/v1")) + .add("id", "https://example.com/credentials/23894672394") + .add("type", Json.createArrayBuilder(List.of("VerifiableCredential", "StatusList2021Credential"))) + .add("issuer", issuer) + .add("issued", "2021-04-05T14:27:40Z") + .add("credentialSubject", Json.createArrayBuilder().add( + Json.createObjectBuilder() + .add("id", "https://example.com/status/3#list") + .add("type", "StatusList2021") + .add("statusPurpose", purpose) + .add("encodedList", createEncodedList()))) + .build(); + + } + + private String createEncodedList() { + return BitString.Writer.newInstance() + .write(bitString) + .orElseThrow((f) -> new EdcException(f.getFailureDetail())); + } +} diff --git a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureBlobHelper.java b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureBlobHelper.java index efdd58941..c53ecb35c 100644 --- a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureBlobHelper.java +++ b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureBlobHelper.java @@ -19,13 +19,13 @@ package org.eclipse.tractusx.edc.dataplane.transfer.test; +import com.azure.core.util.BinaryData; import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.models.BlobItem; import com.azure.storage.blob.sas.BlobContainerSasPermission; import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; -import java.io.IOException; import java.io.InputStream; import java.time.OffsetDateTime; import java.util.List; @@ -60,17 +60,13 @@ private BlobServiceClient blobClient() { } return blobServiceClient; } - + public void uploadBlob(BlobContainerClient client, InputStream inputStream, String targetBlobName) { client.getBlobClient(targetBlobName).upload(inputStream, true); } - public void uploadBlob(BlobContainerClient client, String resourceName) { - try (var is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName)) { - client.getBlobClient(resourceName).upload(is, true); - } catch (IOException e) { - throw new RuntimeException(e); - } + public void uploadBlob(BlobContainerClient client, BinaryData data, String targetBlobName) { + client.getBlobClient(targetBlobName).upload(data, true); } public List listBlobs(String container) { @@ -84,6 +80,7 @@ public List listBlobs(String container) { .toList(); } + public String generateAccountSas(String containerName) { var expiry = OffsetDateTime.MAX.minusDays(1); var permissions = BlobContainerSasPermission.parse("w"); @@ -91,3 +88,4 @@ public String generateAccountSas(String containerName) { return blobClient().getBlobContainerClient(containerName).generateSas(vals); } } + \ No newline at end of file diff --git a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureToAzureTest.java b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureToAzureTest.java index ad62b71cd..ee4762bcd 100644 --- a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureToAzureTest.java +++ b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/AzureToAzureTest.java @@ -19,8 +19,11 @@ package org.eclipse.tractusx.edc.dataplane.transfer.test; +import com.azure.core.util.BinaryData; import io.restassured.http.ContentType; import org.eclipse.edc.azure.testfixtures.annotations.AzureStorageIntegrationTest; +import org.eclipse.edc.junit.testfixtures.TestUtils; +import org.eclipse.edc.spi.types.domain.DataAddress; import org.eclipse.edc.spi.types.domain.transfer.DataFlowStartMessage; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -34,6 +37,8 @@ import java.io.FileInputStream; import java.io.IOException; import java.time.Duration; +import java.util.ArrayDeque; +import java.util.stream.IntStream; import static io.restassured.RestAssured.given; import static org.assertj.core.api.Assertions.assertThat; @@ -48,6 +53,7 @@ import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.AZBLOB_PROVIDER_KEY_ALIAS; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.AZURITE_CONTAINER_PORT; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.AZURITE_DOCKER_IMAGE; +import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.PREFIX_FOR_MUTIPLE_FILES; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.TESTFILE_NAME; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.blobDestinationAddress; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.blobSourceAddress; @@ -66,9 +72,9 @@ @AzureStorageIntegrationTest public class AzureToAzureTest { private static final int PROVIDER_CONTROL_PORT = getFreePort(); - private static final int AZURITE_HOST_PORT = getFreePort(); // launches the data plane + // launches the data plane @RegisterExtension protected static final ParticipantRuntime DATAPLANE_RUNTIME = new ParticipantRuntime( ":edc-tests:runtime:dataplane-cloud", @@ -93,11 +99,49 @@ void setup() { consumerBlobHelper = new AzureBlobHelper(AZBLOB_CONSUMER_ACCOUNT_NAME, AZBLOB_CONSUMER_ACCOUNT_KEY, azuriteContainer.getHost(), azuriteContainer.getMappedPort(AZURITE_CONTAINER_PORT)); } + @Test + void transferMultipleFile_success() { + var sourceContainer = providerBlobHelper.createContainer(AZBLOB_PROVIDER_CONTAINER_NAME); + var filesNames = new ArrayDeque(); + + var fileData = BinaryData.fromString(TestUtils.getResourceFileContentAsString(TESTFILE_NAME)); + var fileNames = IntStream.rangeClosed(1, 2).mapToObj(i -> PREFIX_FOR_MUTIPLE_FILES + i + '_' + TESTFILE_NAME).toList(); + fileNames.forEach(filename -> providerBlobHelper.uploadBlob(sourceContainer, fileData, filename)); + + consumerBlobHelper.createContainer(AZBLOB_CONSUMER_CONTAINER_NAME); + DATAPLANE_RUNTIME.getVault().storeSecret(AZBLOB_PROVIDER_KEY_ALIAS, AZBLOB_PROVIDER_ACCOUNT_KEY); + DATAPLANE_RUNTIME.getVault().storeSecret(AZBLOB_CONSUMER_KEY_ALIAS, """ + {"sas": "%s","edctype":"dataspaceconnector:azuretoken"} + """.formatted(consumerBlobHelper.generateAccountSas(AZBLOB_CONSUMER_CONTAINER_NAME))); + + var request = createMultipleFileFlowRequest(PREFIX_FOR_MUTIPLE_FILES); + var url = "http://localhost:%s/control/transfer".formatted(PROVIDER_CONTROL_PORT); + + + given().when() + .baseUri(url) + .contentType(ContentType.JSON) + .body(request) + .post() + .then() + .log().ifError() + .statusCode(200); + + await().pollInterval(Duration.ofSeconds(2)) + .atMost(Duration.ofSeconds(60)) + .untilAsserted(() -> assertThat(consumerBlobHelper.listBlobs(AZBLOB_CONSUMER_CONTAINER_NAME)) + .isNotEmpty() + .containsAll(filesNames)); + + } + @Test void transferFile_success() { // upload file to provider's blob store - var bcc = providerBlobHelper.createContainer(AZBLOB_PROVIDER_CONTAINER_NAME); - providerBlobHelper.uploadBlob(bcc, TESTFILE_NAME); + var sourceContainer = providerBlobHelper.createContainer(AZBLOB_PROVIDER_CONTAINER_NAME); + var fileData = BinaryData.fromString(TestUtils.getResourceFileContentAsString(TESTFILE_NAME)); + + providerBlobHelper.uploadBlob(sourceContainer, fileData, TESTFILE_NAME); // create container in consumer's blob store consumerBlobHelper.createContainer(AZBLOB_CONSUMER_CONTAINER_NAME); @@ -117,7 +161,6 @@ void transferFile_success() { .body(request) .post() .then() - .log().ifValidationFails() .log().ifError() .statusCode(200); @@ -184,11 +227,10 @@ void transferFile_largeFile(long sizeBytes) throws IOException { @Test void transferFile_targetContainerNotExist_shouldFail() { - // upload file to provider's blob store - var bcc = providerBlobHelper.createContainer(AZBLOB_PROVIDER_CONTAINER_NAME); - providerBlobHelper.uploadBlob(bcc, TESTFILE_NAME); + var sourceContainer = providerBlobHelper.createContainer(AZBLOB_PROVIDER_CONTAINER_NAME); + var fileData = BinaryData.fromString(TestUtils.getResourceFileContentAsString(TESTFILE_NAME)); - // do NOT create container in consumer's blob store + providerBlobHelper.uploadBlob(sourceContainer, fileData, TESTFILE_NAME); DATAPLANE_RUNTIME.getVault().storeSecret(AZBLOB_PROVIDER_KEY_ALIAS, AZBLOB_PROVIDER_ACCOUNT_KEY); DATAPLANE_RUNTIME.getVault().storeSecret(AZBLOB_CONSUMER_KEY_ALIAS, """ @@ -205,11 +247,9 @@ void transferFile_targetContainerNotExist_shouldFail() { .body(request) .post() .then() - .log().ifValidationFails() .log().ifError() .statusCode(200); - // wait until the data plane logs an exception that it cannot transfer the blob await().pollInterval(Duration.ofSeconds(2)) .atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(DATAPLANE_RUNTIME.getContext().getMonitor()) @@ -225,4 +265,19 @@ private DataFlowStartMessage createFlowRequest(String blobName) { .build(); } + private DataFlowStartMessage createMultipleFileFlowRequest(String blobPrefix) { + return DataFlowStartMessage.Builder.newInstance() + .id("test-process-multiple-file-id") + .sourceDataAddress(DataAddress.Builder.newInstance() + .type("AzureStorage").property("container", AZBLOB_PROVIDER_CONTAINER_NAME) + .property("account", AZBLOB_PROVIDER_ACCOUNT_NAME).property("keyName", AZBLOB_PROVIDER_KEY_ALIAS) + .property("blobPrefix", blobPrefix) + .build()) + .destinationDataAddress(DataAddress.Builder.newInstance() + .type("AzureStorage").property("container", AZBLOB_CONSUMER_CONTAINER_NAME) + .property("account", AZBLOB_CONSUMER_ACCOUNT_NAME).property("keyName", AZBLOB_CONSUMER_KEY_ALIAS) + .build()) + .processId("test-process-multiple-file-id").build(); + } } + \ No newline at end of file diff --git a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/MultiCloudTest.java b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/MultiCloudTest.java index fda365150..dd5748814 100644 --- a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/MultiCloudTest.java +++ b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/MultiCloudTest.java @@ -19,6 +19,7 @@ package org.eclipse.tractusx.edc.dataplane.transfer.test; +import com.azure.core.util.BinaryData; import io.restassured.http.ContentType; import org.eclipse.edc.aws.s3.AwsClientProviderConfiguration; import org.eclipse.edc.aws.s3.AwsClientProviderImpl; @@ -44,7 +45,10 @@ import java.net.URI; import java.time.Duration; +import java.util.ArrayDeque; import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.IntStream; import static io.restassured.RestAssured.given; import static org.assertj.core.api.Assertions.assertThat; @@ -55,6 +59,7 @@ import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.AZBLOB_CONSUMER_KEY_ALIAS; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.MINIO_CONTAINER_PORT; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.MINIO_DOCKER_IMAGE; +import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.PREFIX_FOR_MUTIPLE_FILES; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.S3_ACCESS_KEY_ID; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.S3_CONSUMER_BUCKET_NAME; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.TESTFILE_NAME; @@ -114,19 +119,71 @@ void setup() { s3Client = new AwsClientProviderImpl(providerConfig).s3Client(S3ClientRequest.from(REGION, s3EndpointOverride)); } + @Test + void transferFile_azureToS3MultipleFiles() { + var sourceContainer = blobStoreHelper.createContainer(BLOB_CONTAINER_NAME); + var filesNames = new ArrayDeque(); + + var fileData = BinaryData.fromString(TestUtils.getResourceFileContentAsString(TESTFILE_NAME)); + var fileNames = IntStream.rangeClosed(1, 2).mapToObj(i -> PREFIX_FOR_MUTIPLE_FILES + i + '_' + TESTFILE_NAME).toList(); + fileNames.forEach(filename -> blobStoreHelper.uploadBlob(sourceContainer, fileData, filename)); + + DATAPLANE_RUNTIME.getVault().storeSecret(BLOB_KEY_ALIAS, BLOB_ACCOUNT_KEY); + + var destinationBucket = s3Client.createBucket(CreateBucketRequest.builder().bucket(BUCKET_NAME).build()); + assertThat(destinationBucket.sdkHttpResponse().isSuccessful()).isTrue(); + + var dataFlowRequest = DataFlowStartMessage.Builder.newInstance() + .id("test-request-multiple") + .sourceDataAddress(DataAddress.Builder.newInstance() + .type("AzureStorage") + .property("container", BLOB_CONTAINER_NAME) + .property("account", BLOB_ACCOUNT_NAME) + .property("blobPrefix", PREFIX_FOR_MUTIPLE_FILES) + .property("keyName", BLOB_KEY_ALIAS) + .build() + ) + .destinationDataAddress(DataAddress.Builder.newInstance() + .type(S3BucketSchema.TYPE) + .property(S3BucketSchema.REGION, REGION) + .property(S3BucketSchema.BUCKET_NAME, BUCKET_NAME) + .property(S3BucketSchema.ACCESS_KEY_ID, ACCESS_KEY_ID) + .property(S3BucketSchema.SECRET_ACCESS_KEY, SECRET_ACCESS_KEY) + .property(S3BucketSchema.ENDPOINT_OVERRIDE, s3EndpointOverride) + .build() + ) + .processId("test-request-multiple") + .build(); + + + var url = "http://localhost:%s/control/transfer".formatted(PROVIDER_CONTROL_PORT); + given().when() + .baseUri(url) + .contentType(ContentType.JSON) + .body(dataFlowRequest) + .post() + .then() + .log().ifError() + .statusCode(200); + + await().pollInterval(Duration.ofSeconds(2)) + .atMost(Duration.ofSeconds(60)) + .untilAsserted(() -> assertThat(listObjects(s3Client, BUCKET_NAME)) + .isNotEmpty() + .containsAll(filesNames)); + } + @Test void transferFile_azureToS3() { - // create container in Azure Blob, upload file - var bcc = blobStoreHelper.createContainer(BLOB_CONTAINER_NAME); - blobStoreHelper.uploadBlob(bcc, TESTFILE_NAME); + var fileData = BinaryData.fromString(TestUtils.getResourceFileContentAsString(TESTFILE_NAME)); + var sourceContainer = blobStoreHelper.createContainer(BLOB_CONTAINER_NAME); + blobStoreHelper.uploadBlob(sourceContainer, fileData, TESTFILE_NAME); DATAPLANE_RUNTIME.getVault().storeSecret(BLOB_KEY_ALIAS, BLOB_ACCOUNT_KEY); - // create target bucket in S3 var r = s3Client.createBucket(CreateBucketRequest.builder().bucket(BUCKET_NAME).build()); assertThat(r.sdkHttpResponse().isSuccessful()).isTrue(); - // create data flow request - var dfr = DataFlowStartMessage.Builder.newInstance() + var dataFlowRequest = DataFlowStartMessage.Builder.newInstance() .id("test-request") .sourceDataAddress(DataAddress.Builder.newInstance() .type("AzureStorage") @@ -153,10 +210,9 @@ void transferFile_azureToS3() { given().when() .baseUri(url) .contentType(ContentType.JSON) - .body(dfr) + .body(dataFlowRequest) .post() .then() - .log().ifValidationFails() .log().ifError() .statusCode(200); @@ -167,24 +223,150 @@ void transferFile_azureToS3() { .contains(TESTFILE_NAME)); } + + @Test + void transferFile_s3ToAzureMultipleFiles() { + var sourceBucket = s3Client.createBucket(CreateBucketRequest.builder().bucket(BUCKET_NAME).build()); + assertThat(sourceBucket.sdkHttpResponse().isSuccessful()).isTrue(); + + var putResponse = new AtomicBoolean(true); + var filesNames = new ArrayDeque(); + + var fileNames = IntStream.rangeClosed(1, 2).mapToObj(i -> PREFIX_FOR_MUTIPLE_FILES + i + '_' + TESTFILE_NAME).toList(); + fileNames.forEach(filename -> putResponse.set(s3Client.putObject(PutObjectRequest.builder() + .bucket(BUCKET_NAME) + .key(filename) + .build(), TestUtils.getFileFromResourceName(TESTFILE_NAME).toPath()) + .sdkHttpResponse() + .isSuccessful() && putResponse.get())); + assertThat(putResponse.get()).isTrue(); + + blobStoreHelper.createContainer(BLOB_CONTAINER_NAME); + DATAPLANE_RUNTIME.getVault().storeSecret(BLOB_KEY_ALIAS, """ + {"sas": "%s","edctype":"dataspaceconnector:azuretoken"} + """.formatted(blobStoreHelper.generateAccountSas(BLOB_CONTAINER_NAME))); + + + var dataFlowRequest = DataFlowStartMessage.Builder.newInstance() + .id("test-request") + .sourceDataAddress(DataAddress.Builder.newInstance() + .type(S3BucketSchema.TYPE) + .property(S3BucketSchema.KEY_PREFIX, PREFIX_FOR_MUTIPLE_FILES) + .property(S3BucketSchema.REGION, REGION) + .property(S3BucketSchema.BUCKET_NAME, BUCKET_NAME) + .property(S3BucketSchema.ACCESS_KEY_ID, S3_ACCESS_KEY_ID) + .property(S3BucketSchema.SECRET_ACCESS_KEY, SECRET_ACCESS_KEY) + .property(S3BucketSchema.ENDPOINT_OVERRIDE, s3EndpointOverride) + .build() + ) + .destinationDataAddress( + DataAddress.Builder.newInstance() + .type("AzureStorage") + .property("container", AZBLOB_CONSUMER_CONTAINER_NAME) + .property("account", AZBLOB_CONSUMER_ACCOUNT_NAME) + .property("keyName", AZBLOB_CONSUMER_KEY_ALIAS) + .build() + ) + .processId("test-process-multiple-file-id") + .build(); + + + var url = "http://localhost:%s/control/transfer".formatted(PROVIDER_CONTROL_PORT); + given().when() + .baseUri(url) + .contentType(ContentType.JSON) + .body(dataFlowRequest) + .post() + .then() + .statusCode(200); + + await().pollInterval(Duration.ofSeconds(2)) + .atMost(Duration.ofSeconds(60)) + .untilAsserted(() -> assertThat(blobStoreHelper.listBlobs(BLOB_CONTAINER_NAME)) + .isNotEmpty() + .containsAll(filesNames)); + } + + + @Test + void transferFile_s3ToAzureMultipleFiles_whenConsumerDefinesBloblName_success() { + var sourceBucket = s3Client.createBucket(CreateBucketRequest.builder().bucket(BUCKET_NAME).build()); + assertThat(sourceBucket.sdkHttpResponse().isSuccessful()).isTrue(); + + var putResponse = new AtomicBoolean(true); + var filesNames = new ArrayDeque(); + + var fileNames = IntStream.rangeClosed(1, 2).mapToObj(i -> PREFIX_FOR_MUTIPLE_FILES + i + '_' + TESTFILE_NAME).toList(); + fileNames.forEach(filename -> putResponse.set(s3Client.putObject(PutObjectRequest.builder() + .bucket(BUCKET_NAME) + .key(filename) + .build(), TestUtils.getFileFromResourceName(TESTFILE_NAME).toPath()) + .sdkHttpResponse() + .isSuccessful() && putResponse.get())); + + assertThat(putResponse.get()).isTrue(); + + blobStoreHelper.createContainer(BLOB_CONTAINER_NAME); + DATAPLANE_RUNTIME.getVault().storeSecret(BLOB_KEY_ALIAS, """ + {"sas": "%s","edctype":"dataspaceconnector:azuretoken"} + """.formatted(blobStoreHelper.generateAccountSas(BLOB_CONTAINER_NAME))); + + + var dataFlowRequest = DataFlowStartMessage.Builder.newInstance() + .id("test-request") + .sourceDataAddress(DataAddress.Builder.newInstance() + .type(S3BucketSchema.TYPE) + .property(S3BucketSchema.KEY_PREFIX, PREFIX_FOR_MUTIPLE_FILES) + .property(S3BucketSchema.REGION, REGION) + .property(S3BucketSchema.BUCKET_NAME, BUCKET_NAME) + .property(S3BucketSchema.ACCESS_KEY_ID, S3_ACCESS_KEY_ID) + .property(S3BucketSchema.SECRET_ACCESS_KEY, SECRET_ACCESS_KEY) + .property(S3BucketSchema.ENDPOINT_OVERRIDE, s3EndpointOverride) + .build() + ) + .destinationDataAddress( + DataAddress.Builder.newInstance() + .type("AzureStorage") + .property("container", AZBLOB_CONSUMER_CONTAINER_NAME) + .property("account", AZBLOB_CONSUMER_ACCOUNT_NAME) + .property("keyName", AZBLOB_CONSUMER_KEY_ALIAS) + .property("blobName", "NOME_TEST") + .build() + ) + .processId("test-process-multiple-file-id") + .build(); + + + var url = "http://localhost:%s/control/transfer".formatted(PROVIDER_CONTROL_PORT); + given().when() + .baseUri(url) + .contentType(ContentType.JSON) + .body(dataFlowRequest) + .post() + .then() + .statusCode(200); + + await().pollInterval(Duration.ofSeconds(2)) + .atMost(Duration.ofSeconds(60)) + .untilAsserted(() -> assertThat(blobStoreHelper.listBlobs(BLOB_CONTAINER_NAME)) + .isNotEmpty() + .containsAll(filesNames)); + } + + @Test void transferFile_s3ToAzure() { - // create source bucket in S3, upload file var b1 = s3Client.createBucket(CreateBucketRequest.builder().bucket(BUCKET_NAME).build()); assertThat(b1.sdkHttpResponse().isSuccessful()).isTrue(); var putResponse = s3Client.putObject(PutObjectRequest.builder().bucket(BUCKET_NAME).key(TESTFILE_NAME).build(), TestUtils.getFileFromResourceName(TESTFILE_NAME).toPath()); assertThat(putResponse.sdkHttpResponse().isSuccessful()).isTrue(); - - // create container in consumer's blob store blobStoreHelper.createContainer(BLOB_CONTAINER_NAME); DATAPLANE_RUNTIME.getVault().storeSecret(BLOB_KEY_ALIAS, """ {"sas": "%s","edctype":"dataspaceconnector:azuretoken"} """.formatted(blobStoreHelper.generateAccountSas(BLOB_CONTAINER_NAME))); - - // create data flow request - var dfr = DataFlowStartMessage.Builder.newInstance() + var dataFlowRequest = DataFlowStartMessage.Builder.newInstance() .id("test-request") .sourceDataAddress(DataAddress.Builder.newInstance() .type(S3BucketSchema.TYPE) @@ -204,7 +386,7 @@ void transferFile_s3ToAzure() { given().when() .baseUri(url) .contentType(ContentType.JSON) - .body(dfr) + .body(dataFlowRequest) .post() .then() .statusCode(200); diff --git a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/S3ToS3Test.java b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/S3ToS3Test.java index e4b18e4ba..df4e46b45 100644 --- a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/S3ToS3Test.java +++ b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/S3ToS3Test.java @@ -49,14 +49,18 @@ import java.io.File; import java.net.URI; import java.time.Duration; +import java.util.ArrayDeque; import java.util.UUID; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.IntStream; import static io.restassured.RestAssured.given; import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.util.io.Ports.getFreePort; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.MINIO_CONTAINER_PORT; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.MINIO_DOCKER_IMAGE; +import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.PREFIX_FOR_MUTIPLE_FILES; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.S3_ACCESS_KEY_ID; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.S3_CONSUMER_BUCKET_NAME; import static org.eclipse.tractusx.edc.dataplane.transfer.test.TestConstants.S3_PROVIDER_BUCKET_NAME; @@ -117,6 +121,47 @@ void setup() { consumerClient = new AwsClientProviderImpl(consumerConfig).s3Client(S3ClientRequest.from(S3_REGION, consumerEndpointOverride)); } + + @Test + void transferMultipleFiles() { + var sourceBucket = providerClient.createBucket(CreateBucketRequest.builder().bucket(S3_PROVIDER_BUCKET_NAME).build()); + assertThat(sourceBucket.sdkHttpResponse().isSuccessful()).isTrue(); + var putResponse = new AtomicBoolean(true); + var filesNames = new ArrayDeque(); + + var fileNames = IntStream.rangeClosed(1, 2).mapToObj(i -> PREFIX_FOR_MUTIPLE_FILES + i + '_' + TESTFILE_NAME).toList(); + fileNames.forEach(filename -> putResponse.set(providerClient.putObject(PutObjectRequest.builder() + .bucket(S3_PROVIDER_BUCKET_NAME) + .key(filename) + .build(), TestUtils.getFileFromResourceName(TESTFILE_NAME).toPath()) + .sdkHttpResponse() + .isSuccessful() && putResponse.get())); + + + assertThat(putResponse.get()).isTrue(); + + var destinationBucket = consumerClient.createBucket(CreateBucketRequest.builder().bucket(S3_CONSUMER_BUCKET_NAME).build()); + assertThat(destinationBucket.sdkHttpResponse().isSuccessful()).isTrue(); + var request = createMultipleFileFlowRequest(); + var url = "http://localhost:%s/control/transfer".formatted(PROVIDER_CONTROL_PORT); + + given().when() + .baseUri(url) + .contentType(ContentType.JSON) + .body(request) + .post() + .then() + .statusCode(200); + + await().pollInterval(Duration.ofSeconds(2)) + .atMost(Duration.ofSeconds(60)) + .untilAsserted(() -> + assertThat(listObjects(consumerClient, S3_CONSUMER_BUCKET_NAME)) + .isNotEmpty() + .containsAll(filesNames)); + } + + @Test void transferFile_success() { @@ -271,4 +316,31 @@ private DataFlowStartMessage createFlowRequest() { .build(); } -} + + private DataFlowStartMessage createMultipleFileFlowRequest() { + return DataFlowStartMessage.Builder.newInstance() + .id("test-process-multiple-file-id") + .sourceDataAddress(DataAddress.Builder.newInstance() + .type(S3BucketSchema.TYPE) + .property(S3BucketSchema.KEY_PREFIX, PREFIX_FOR_MUTIPLE_FILES) + .property(S3BucketSchema.REGION, S3_REGION) + .property(S3BucketSchema.BUCKET_NAME, S3_PROVIDER_BUCKET_NAME) + .property(S3BucketSchema.ACCESS_KEY_ID, S3_ACCESS_KEY_ID) + .property(S3BucketSchema.SECRET_ACCESS_KEY, SECRET_ACCESS_KEY) + .property(S3BucketSchema.ENDPOINT_OVERRIDE, providerEndpointOverride) + .build() + ) + .destinationDataAddress(DataAddress.Builder.newInstance() + .type(S3BucketSchema.TYPE) + .property(S3BucketSchema.REGION, S3_REGION) + .property(S3BucketSchema.BUCKET_NAME, S3_CONSUMER_BUCKET_NAME) + .property(S3BucketSchema.ACCESS_KEY_ID, S3_ACCESS_KEY_ID) + .property(S3BucketSchema.SECRET_ACCESS_KEY, SECRET_ACCESS_KEY) + .property(S3BucketSchema.ENDPOINT_OVERRIDE, consumerEndpointOverride) + .build() + ) + .processId("test-process-multiple-file-id") + .build(); + } + +} \ No newline at end of file diff --git a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/TestConstants.java b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/TestConstants.java index 34633f9be..08ba6912d 100644 --- a/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/TestConstants.java +++ b/edc-tests/edc-dataplane/cloud-transfer-tests/src/test/java/org/eclipse/tractusx/edc/dataplane/transfer/test/TestConstants.java @@ -31,9 +31,9 @@ public class TestConstants { public static final String AZBLOB_CONSUMER_ACCOUNT_NAME = "consumer"; public static final String AZBLOB_CONSUMER_ACCOUNT_KEY = "consumerkey"; // alias under which the provider key is stored in the vault. must end with -key1 - public static final String AZBLOB_PROVIDER_KEY_ALIAS = "providerkey-key1"; + public static final String AZBLOB_PROVIDER_KEY_ALIAS = "provider-key1"; // alias under which the consumer key is stored in the vault. must end with -key1 - public static final String AZBLOB_CONSUMER_KEY_ALIAS = "consumerkey-key1`"; + public static final String AZBLOB_CONSUMER_KEY_ALIAS = "consumer-key1"; public static final String AZBLOB_PROVIDER_CONTAINER_NAME = "src-container"; public static final String AZBLOB_CONSUMER_CONTAINER_NAME = "dest-container"; // AMAZON S3 CONSTANTS @@ -45,6 +45,7 @@ public class TestConstants { public static final String S3_ACCESS_KEY_ID = "test-access-key"; // user name // GENERIC CONSTANTS public static final String TESTFILE_NAME = "testfile.json"; + public static final String PREFIX_FOR_MUTIPLE_FILES = "m/"; public static DataAddress blobSourceAddress(String blobName) { return DataAddress.Builder.newInstance() diff --git a/gradle.properties b/gradle.properties index 1e6531c7e..e417647cc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=org.eclipse.tractusx.edc -version=0.7.0-rc1 +version=0.7.0 # configure the build: txScmConnection=scm:git:git@github.com:eclipse-tractusx/tractusx-edc.git txWebsiteUrl=https://github.com/eclipse-tractusx/tractusx-edc.git diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 30969fcf5..490f3c4d3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,14 +2,14 @@ format.version = "1.1" [versions] -edc = "0.6.1-20240405-SNAPSHOT" +edc = "0.6.1" apache-sshd = "2.12.1" assertj = "3.25.3" awaitility = "4.2.0" -aws = "2.25.21" +aws = "2.25.26" azure-identity = "1.11.4" -bouncyCastle-jdk18on = "1.77" -flyway = "10.10.0" +bouncyCastle-jdk18on = "1.78" +flyway = "10.11.0" jackson = "2.17.0" jakarta-json = "2.0.1" jupiter = "5.10.2" @@ -22,7 +22,7 @@ restAssured = "5.4.0" rsApi = "3.1.0" slf4j = "2.0.12" testcontainers = "1.19.7" -tink = "1.12.0" +tink = "1.13.0" titanium = "1.4.0" [libraries] @@ -37,6 +37,7 @@ edc-spi-transaction-datasource = { module = "org.eclipse.edc:transaction-datasou edc-spi-transactionspi = { module = "org.eclipse.edc:transaction-spi", version.ref = "edc" } edc-spi-controlplane = { module = "org.eclipse.edc:control-plane-spi", version.ref = "edc" } edc-controlplane-apiclient = { module = "org.eclipse.edc:control-plane-api-client", version.ref = "edc" } +edc-spi-boot = { module = "org.eclipse.edc:web-spi", version.ref = "edc" } edc-spi-web = { module = "org.eclipse.edc:web-spi", version.ref = "edc" } edc-spi-http = { module = "org.eclipse.edc:http-spi", version.ref = "edc" } edc-spi-keys = { module = "org.eclipse.edc:keys-spi", version.ref = "edc" } @@ -64,6 +65,7 @@ edc-core-policy-monitor = { module = "org.eclipse.edc:policy-monitor-core", vers edc-core-sql = { module = "org.eclipse.edc:sql-core", version.ref = "edc" } edc-core-token = { module = "org.eclipse.edc:token-core", version.ref = "edc" } edc-core-edrstore = { module = "org.eclipse.edc:edr-store-core", version.ref = "edc" } +edc-controlplane-callback-staticendpoint = { module = "org.eclipse.edc:callback-static-endpoint", version.ref = "edc" } edc-junit = { module = "org.eclipse.edc:junit", version.ref = "edc" } edc-api-management-config = { module = "org.eclipse.edc:management-api-configuration", version.ref = "edc" } edc-api-management = { module = "org.eclipse.edc:management-api", version.ref = "edc" } @@ -84,6 +86,7 @@ edc-ext-azure-cosmos-core = { module = "org.eclipse.edc:azure-cosmos-core", vers edc-ext-azure-test = { module = "org.eclipse.edc:azure-test", version.ref = "edc" } edc-ext-jsonld = { module = "org.eclipse.edc:json-ld", version.ref = "edc" } edc-validator-data-address-http-data = { module = "org.eclipse.edc:validator-data-address-http-data", version.ref = "edc" } +edc-runtime-metamodel = { module = "org.eclipse.edc:runtime-metamodel", version.ref = "edc" } # EDC lib dependencies edc-lib-boot = { module = "org.eclipse.edc:boot-lib", version.ref = "edc" } @@ -136,6 +139,7 @@ edc-core-did = { module = "org.eclipse.edc:identity-did-core", version.ref = "ed edc-identity-did-web = { module = "org.eclipse.edc:identity-did-web", version.ref = "edc" } edc-identity-vc-ldp = { module = "org.eclipse.edc:ldp-verifiable-credentials", version.ref = "edc" } edc-identity-vc-jwt = { module = "org.eclipse.edc:jwt-verifiable-credentials", version.ref = "edc" } +edc-identity-trust-service = { module = "org.eclipse.edc:identity-trust-service", version.ref = "edc" } edc-identity-trust-transform = { module = "org.eclipse.edc:identity-trust-transform", version.ref = "edc" } edc-identity-trust-issuers-configuration = { module = "org.eclipse.edc:identity-trust-issuers-configuration", version.ref = "edc" } diff --git a/samples/multi-tenancy/build.gradle.kts b/samples/multi-tenancy/build.gradle.kts index ad6cd1d8e..b8ffaf6c4 100644 --- a/samples/multi-tenancy/build.gradle.kts +++ b/samples/multi-tenancy/build.gradle.kts @@ -28,8 +28,6 @@ dependencies { implementation(libs.edc.boot) implementation(libs.edc.iam.mock) implementation(project(":edc-controlplane:edc-controlplane-base")) { - exclude(module = "ssi-miw-credential-client") - exclude(module = "ssi-identity-core") exclude(module = "auth-tokenbased") // the token refresh extension is not needed exclude(module = "tx-iatp-sts-dim") diff --git a/settings.gradle.kts b/settings.gradle.kts index c33a612e9..980a606c5 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -44,9 +44,6 @@ include(":edc-extensions:migrations:data-plane-migration") include(":edc-extensions:tokenrefresh-handler") include(":edc-extensions:bdrs-client") include(":edc-extensions:provision-additional-headers") -include(":edc-extensions:transferprocess-sftp-client") -include(":edc-extensions:transferprocess-sftp-common") -include(":edc-extensions:transferprocess-sftp-provisioner") include(":edc-extensions:edr:edr-api-v2") include(":edc-extensions:edr:edr-callback") include(":edc-extensions:cx-policy") diff --git a/spi/bdrs-client-spi/build.gradle.kts b/spi/bdrs-client-spi/build.gradle.kts index 63365c44c..2d3ad0901 100644 --- a/spi/bdrs-client-spi/build.gradle.kts +++ b/spi/bdrs-client-spi/build.gradle.kts @@ -23,5 +23,5 @@ plugins { } dependencies { - implementation(libs.edc.spi.core) + implementation(libs.edc.runtime.metamodel) } diff --git a/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/TxIatpConstants.java b/spi/core-spi/src/main/java/org/eclipse/tractusx/edc/TxIatpConstants.java similarity index 84% rename from edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/TxIatpConstants.java rename to spi/core-spi/src/main/java/org/eclipse/tractusx/edc/TxIatpConstants.java index b1158568a..ef7d776c1 100644 --- a/edc-extensions/iatp/tx-iatp/src/main/java/org/eclipse/tractusx/edc/iam/iatp/TxIatpConstants.java +++ b/spi/core-spi/src/main/java/org/eclipse/tractusx/edc/TxIatpConstants.java @@ -1,5 +1,5 @@ -/******************************************************************************** - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) +/* + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -15,9 +15,9 @@ * under the License. * * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ + */ -package org.eclipse.tractusx.edc.iam.iatp; +package org.eclipse.tractusx.edc; import java.util.Set; diff --git a/spi/core-spi/src/main/java/org/eclipse/tractusx/edc/edr/spi/CoreConstants.java b/spi/core-spi/src/main/java/org/eclipse/tractusx/edc/edr/spi/CoreConstants.java index f21301a1b..118227804 100644 --- a/spi/core-spi/src/main/java/org/eclipse/tractusx/edc/edr/spi/CoreConstants.java +++ b/spi/core-spi/src/main/java/org/eclipse/tractusx/edc/edr/spi/CoreConstants.java @@ -26,13 +26,13 @@ public final class CoreConstants { public static final String TX_PREFIX = "tx"; public static final String TX_AUTH_PREFIX = "tx-auth"; + public static final String CX_POLICY_PREFIX = "cx-policy"; public static final String TX_NAMESPACE = "https://w3id.org/tractusx/v0.0.1/ns/"; public static final String TX_CONTEXT = "https://w3id.org/tractusx/edc/v0.0.1"; public static final String TX_AUTH_NS = "https://w3id.org/tractusx/auth/"; public static final String EDC_CONTEXT = "https://w3id.org/edc/v0.0.1"; public static final String CX_CREDENTIAL_NS = "https://w3id.org/catenax/credentials/"; public static final String CX_POLICY_NS = "https://w3id.org/catenax/policy/"; - public static final String TX_CREDENTIAL_NAMESPACE = "https://w3id.org/tractusx/credentials/v0.0.1/ns/"; // constants related to token refresh/renewal public static final String EDR_PROPERTY_AUTHORIZATION = EDC_NAMESPACE + "authorization";