Skip to content

Commit

Permalink
Merge pull request #205 from catenax-ng/release/v2.1.0-backend-agree
Browse files Browse the repository at this point in the history
[ 19º ] - Release/v2.1.0 backend agree: Enabled policy selection and handling of more than one contract in the backend
  • Loading branch information
matbmoser authored Feb 2, 2024
2 parents 320a2f7 + 860c3f8 commit b60f636
Show file tree
Hide file tree
Showing 54 changed files with 2,078 additions and 1,593 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ repos:
- repo: https://github.com/gitguardian/ggshield
rev: v1.13.6
hooks:
# - id: ggshield
# language_version: python3
# stages: [commit]
- id: ggshield
language_version: python3
stages: [commit]
- id: ggshield
language_version: python3
stages: [push]
stages: [push]
116 changes: 58 additions & 58 deletions DEPENDENCIES_BACKEND

Large diffs are not rendered by default.

101 changes: 43 additions & 58 deletions DEPENDENCIES_FRONTEND

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions charts/digital-product-pass/templates/deployment-frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ spec:
- name: "AUTH_BPN_NUMBER"
value: "{{ .Values.oauth.bpnCheck.bpn }}"

- name: "APP_AUTO_SIGN"
value: "{{ .Values.frontend.negotiation.autoSign }}"

- name: "APP_PORTAL_URL"
value: "https://{{ .Values.frontend.portal.hostname }}"

Expand All @@ -87,8 +90,11 @@ spec:
- name: "IDP_URL"
value: "https://{{ .Values.oauth.hostname }}"

- name: "API_TIMEOUT"
value: "{{ .Values.frontend.api.timeout }}"
- name: "API_NEGOTIATE_TIMEOUT"
value: "{{ .Values.frontend.api.negotiateTimeout }}"

- name: "API_SEARCH_TIMEOUT"
value: "{{ .Values.frontend.api.searchTimeout }}"

- name: "API_MAX_RETRIES"
value: "{{ .Values.frontend.api.max_retries }}"
Expand Down
15 changes: 9 additions & 6 deletions charts/digital-product-pass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ backend:
catalog: "/catalog/request"
negotiation: "/contractnegotiations"
transfer: "/transferprocesses"
# -- Negotiation status Delay in milliseconds in between async requests [<= 500]
delay: 100
delay: 100 # -- Negotiation status Delay in milliseconds in between async requests [<= 500]

# -- backend hostname (without protocol prefix [DEFAULT HTTPS] for security )
hostname: *hostname
Expand Down Expand Up @@ -129,13 +128,12 @@ backend:
# -- unique sha512 hash key used for the passport encryption
encryptionKey: ""

# -- passport data transfer configuration
passport:
# -- passport versions and aspects allowed
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:bamm:io.catenax.transmission.transmission_pass:1.0.0#TransmissionPass"
- "urn:samm:io.catenax.generic.digital_product_passport:2.0.0#DigitalProductPassport"

digitalTwinRegistry:
endpoints:
Expand Down Expand Up @@ -183,7 +181,7 @@ frontend:
ingress:
enabled: false
hosts: []

# -- The [pod security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) defines privilege and access control settings for a Pod within the deployment
podSecurityContext:
seccompProfile:
Expand Down Expand Up @@ -227,12 +225,17 @@ frontend:
portal:
hostname: ""

negotiation:
autoSign: true

# -- api timeouts
api:
# -- max retries for getting status
max_retries: 30
# -- default timeout - 90 seconds in milliseconds
timeout: 90000
negotiateTimeout: 20000
searchTimeout: 40000

# -- delay from getting status
delay: 1000

Expand Down
8 changes: 0 additions & 8 deletions dpp-backend/charts/digital-product-pass-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ process:
# -- unique sha512 hash key used for the passport encryption
encryptionKey: ""

# -- passport data transfer configuration
passport:
# -- passport versions and aspects allowed
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:bamm:io.catenax.transmission.transmission_pass:1.0.0#TransmissionPass"

digitalTwinRegistry:
endpoints:
search: "/lookup/shells"
Expand Down
6 changes: 3 additions & 3 deletions dpp-backend/digitalproductpass/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>digitalproductpass</artifactId>
<version>2.0.3</version>
<version>2.1.0</version>
<packaging>jar</packaging>
<name>Catena-X Digital Product Passport Backend</name>
<description>Digital Product Passport Consumer Backend Reference Implementation System for Product Passport Consumer Frontend Application
Expand Down Expand Up @@ -179,7 +179,7 @@
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.3</version>
<version>2.0.2</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.eclipse.tractusx.digitalproductpass.config.DtrConfig;
import org.eclipse.tractusx.digitalproductpass.config.IrsConfig;
import org.eclipse.tractusx.digitalproductpass.config.PassportConfig;
Expand Down Expand Up @@ -232,6 +233,7 @@ public Response getDigitalTwin(@RequestBody Object body, @PathVariable String pr
));
String bpn = dtr.getBpn();
Boolean childrenCondition = search.getChildren();
processManager.saveDtr(processId, endpointId);
processManager.saveTransferInfo(processId, connectorAddress, semanticId, dataPlaneUrl, bpn, childrenCondition);
processManager.saveDigitalTwin(processId, digitalTwin, dtRequestTime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,19 @@ public Response getData(@Valid @RequestBody TokenRequest tokenRequestBody) {
}

// Check if the contract id is correct
History history = status.getHistory("contract-dataset");
if (!history.getId().equals(contractId)) {
response = httpUtil.getBadRequest("This contract id is incorrect!");
return httpUtil.buildResponse(response, httpResponse);
}

Map<String, Dataset> availableContracts = processManager.loadDatasets(processId);
String seedId = String.join("|",availableContracts.keySet()); // Generate Seed
// Check the validity of the token
String expectedToken = processManager.generateToken(process, contractId);
String expectedToken = processManager.generateToken(process, seedId);
String token = tokenRequestBody.getToken();
if (!expectedToken.equals(token)) {
response = httpUtil.getForbiddenResponse("The token is invalid!");
return httpUtil.buildResponse(response, httpResponse);
}
Dataset dataset = availableContracts.get(contractId);

if (status.historyExists("contract-decline")) {
response = httpUtil.getForbiddenResponse("The contract for this passport has been declined!");
if (dataset == null) {
response.message = "The Contract Selected was not found!";
return httpUtil.buildResponse(response, httpResponse);
}

Expand All @@ -187,7 +184,6 @@ public Response getData(@Valid @RequestBody TokenRequest tokenRequestBody) {
response = httpUtil.getNotFound("Failed to load passport!");
return httpUtil.buildResponse(response, httpResponse);
}
Dataset dataset = processManager.loadDataset(processId);
Map<String, Object> negotiation = processManager.loadNegotiation(processId);
Map<String, Object> transfer = processManager.loadTransfer(processId);
response = httpUtil.getResponse();
Expand Down
Loading

0 comments on commit b60f636

Please sign in to comment.