Skip to content

Commit

Permalink
Merge pull request #342 from eclipse-tractusx/feature/verification-ba…
Browse files Browse the repository at this point in the history
…ckend

Feature/verification backend: Added Verification Add-on + Modularized Backend to Core
  • Loading branch information
matbmoser authored Jul 3, 2024
2 parents 8096f62 + ece199f commit 89cc92d
Show file tree
Hide file tree
Showing 135 changed files with 3,430 additions and 949 deletions.
2 changes: 1 addition & 1 deletion charts/digital-product-pass/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)

version: 3.1.1
version: 3.1.2

# 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
Expand Down
18 changes: 18 additions & 0 deletions charts/digital-product-pass/templates/configmap-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,24 @@ data:
enabled: {{ .Values.backend.passport.policyCheck.enabled }}
strictMode: {{ .Values.backend.passport.policyCheck.strictMode }}
policies: {{- toYaml .Values.backend.passport.policyCheck.policies | nindent 10 }}
# -- digital product pass verification add-on configuration
verification:
enabled: {{ .Values.backend.verification.enabled }}
autoVerify: {{ .Values.backend.verification.autoVerify }}
wallet:
url: {{ .Values.backend.verification.wallet.url }}
endpoints:
health: {{ .Values.backend.verification.wallet.endpoints.health }}
verify: {{ .Values.backend.verification.wallet.endpoints.verify }}
certifiedDataCredential:
## -- These keys are used in order to find if a subModel contains a verifiable credential, defined in the verification documentation
semanticIdKeys:
- key: "Entity"
value: "https://www.w3.org/ns/credentials/v2"
- key: "DataElement"
value: "urn:samm:io.catenax.dpp_verification.cdc:1.0.0#CertifiedDataCredential"
- key: "Operation"
value: "https://w3c.github.io/vc-jws-2020/contexts/v1/"
# -- configuration of the spring boot server
server:
# -- configuration of backend errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
valueFrom:
secretKeyRef:
key: appId
name: {{ .Release.Name }}-backend-auth
name: {{ .Release.Name }}-backend-auth
- name: "client.id"
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -89,6 +89,11 @@ spec:
secretKeyRef:
key: irsApiKey
name: {{ .Release.Name }}-backend-auth
- name: "wallet.apiKey"
valueFrom:
secretKeyRef:
key: walletApiKey
name: {{ .Release.Name }}-backend-auth
volumeMounts:
{{- toYaml .Values.backend.volumeMounts | nindent 12 }}
ports:
Expand Down
40 changes: 20 additions & 20 deletions charts/digital-product-pass/templates/ingress-backend.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#################################################################################
# Tractus-X - Digital Product Passport Application
#
# Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
#
# Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
# Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
# Copyright (c) 2022, 2024 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 govern in permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################
# Copyright (c) 2022, 2024 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 govern in permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################

{{- if .Values.backend.ingress.enabled -}}
{{- $fullName := .Values.backend.name -}}
Expand Down
40 changes: 20 additions & 20 deletions charts/digital-product-pass/templates/ingress-frontend.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#################################################################################
# Tractus-X - Digital Product Passport Application
#
# Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
#
# Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
# Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
# Copyright (c) 2022, 2024 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 govern in permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################
# Copyright (c) 2022, 2024 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 govern in permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################

{{- if .Values.frontend.ingress.enabled -}}
{{- $fullName := .Values.frontend.name -}}
Expand Down
1 change: 1 addition & 0 deletions charts/digital-product-pass/templates/secret-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ stringData:
clientSecret: {{ .Values.oauth.techUser.clientSecret }}
xApiKey: {{ .Values.oauth.apiKey.secret }}
irsApiKey: {{ .Values.backend.irs.apiKey }}
walletApiKey: {{ .Values.backend.verification.wallet.apiKey }}
---

apiVersion: v1
Expand Down
5 changes: 4 additions & 1 deletion charts/digital-product-pass/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ backend:
xApiKey: <path:material-pass/data/int/edc/oauth#api.key>
participantId: &bpn <path:material-pass/data/int/edc/participant#bpnNumber>
hostname: "materialpass.int.demo.catena-x.net/consumer"


hostname: *hostname
securityCheck:
Expand All @@ -69,6 +69,9 @@ backend:
maxRetries: 30
delay: 1000

verification:
wallet:
url: "https://dpp-consumer-wallet.int.demo.catena-x.net"

frontend:
image:
Expand Down
20 changes: 13 additions & 7 deletions charts/digital-product-pass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,21 @@ backend:
# -- unique sha512 hash key used for the passport encryption
encryptionKey: ""

verification:
enabled: true
autoVerify: true
wallet:
url: "https://<dpp-consumer-wallet.url>"
apiKey: "<Add API Key>"
endpoints:
health: "/health"
verify: "/verify"

passport:
aspects:
- "urn:bamm:io.catenax.generic.digital_product_passport:1.0.0#DigitalProductPassport"
- "urn:bamm:io.catenax.battery.battery_pass:3.0.1#BatteryPass"
- urn:samm:io.catenax.battery.battery_pass:6.0.0#BatteryPass
- "urn:bamm:io.catenax.transmission.transmission_pass:1.0.0#TransmissionPass"
- urn:samm:io.catenax.transmission.transmission_pass:3.0.0#TransmissionPass
- "urn:samm:io.catenax.generic.digital_product_passport:2.0.0#DigitalProductPassport"
- urn:samm:io.catenax.generic.digital_product_passport:5.0.0#DigitalProductPassport
- "urn:samm:io.catenax.battery.battery_pass:6.0.0#BatteryPass"
- "urn:samm:io.catenax.transmission.transmission_pass:3.0.0#TransmissionPass"
- "urn:samm:io.catenax.generic.digital_product_passport:5.0.0#DigitalProductPassport"
# -- configuration for policies to filter in the digital product pass asset negotiation
policyCheck:
# -- condition to enable and disable the policy check
Expand Down
7 changes: 4 additions & 3 deletions dpp-backend/digitalproductpass/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@
</parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>digitalproductpass</artifactId>
<version>3.0.0</version>
<version>4.0.0</version>
<packaging>jar</packaging>
<name>Catena-X Digital Product Passport Backend</name>
<name>Catena-X Digital Product Passport Core + Verification Add-on</name>
<description>
Digital Product Passport Consumer Backend is a reference implementation system for retrieving aspect models of digital twins in the Catena-X Network.
Digital Product Passport Backend is a reference implementation system for retrieving aspect models of digital twins in the Catena-X Network.
It additionally includes the Digital Product Passport Verification Add-on.
</description>
<properties>
<java.version>19</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@
********************************************************************************/

package org.eclipse.tractusx.digitalproductpass;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.media.JsonSchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
Expand All @@ -41,6 +47,10 @@
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import utils.FileUtil;
import utils.JsonUtil;

import java.io.File;


/**
Expand All @@ -62,6 +72,10 @@ public class Application {
@Autowired
BuildProperties buildProperties;
@Autowired
FileUtil fileUtil;
@Autowired
JsonUtil jsonUtil;
@Autowired
Environment env;
public static void main(String[] args) {

Expand All @@ -72,8 +86,18 @@ public static void main(String[] args) {
}

@Bean
public OpenAPI openApiConfig(){
return new OpenAPI().info(getApiInfo());
public OpenAPI openApiConfig() throws Exception {
return new OpenAPI().info(getApiInfo()).components(this.loadSchemas());
}

public Components loadSchemas() throws Exception {
String content = fileUtil.getResourceFileAsString(fileUtil.getResourceContent(this.getClass(), "schemas/dpp-cdc.jsonld"));
if(content == null){
throw new Exception("It was not possible to load the dpp schema file");
}
return new Components().addSchemas(
"CertifiedDataCredential", new JsonSchema().example(jsonUtil.parseJson(content))
);
}

public Info getApiInfo(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*********************************************************************************
*
* Tractus-X - Digital Product Passport Application
* Tractus-X - Digital Product Pass Application
*
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand All @@ -24,7 +24,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.tractusx.digitalproductpass.config;
package org.eclipse.tractusx.digitalproductpass.core.config;


import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*********************************************************************************
*
* Tractus-X - Digital Product Passport Application
* Tractus-X - Digital Product Pass Application
*
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand All @@ -24,7 +24,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.tractusx.digitalproductpass.config;
package org.eclipse.tractusx.digitalproductpass.core.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*********************************************************************************
*
* Tractus-X - Digital Product Passport Application
* Tractus-X - Digital Product Pass Application
*
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand All @@ -24,7 +24,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.tractusx.digitalproductpass.config;
package org.eclipse.tractusx.digitalproductpass.core.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*********************************************************************************
*
* Tractus-X - Digital Product Passport Application
* Tractus-X - Digital Product Pass Application
*
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand All @@ -24,7 +24,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.tractusx.digitalproductpass.config;
package org.eclipse.tractusx.digitalproductpass.core.config;

import com.sun.source.tree.Tree;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*********************************************************************************
*
* Tractus-X - Digital Product Passport Application
* Tractus-X - Digital Product Pass Application
*
* Copyright (c) 2022, 2024 BMW AG, Henkel AG & Co. KGaA
* Copyright (c) 2023, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 CGI Deutschland B.V. & Co. KG
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
*
*
Expand All @@ -24,7 +24,7 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

package org.eclipse.tractusx.digitalproductpass.config;
package org.eclipse.tractusx.digitalproductpass.core.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
Expand Down
Loading

0 comments on commit 89cc92d

Please sign in to comment.