From 03a75f33b00fc786f5d04991887fc7429a122242 Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Mon, 17 Feb 2025 14:30:28 +0100 Subject: [PATCH 1/9] feat: Add the database dependencies --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index ba99b23..89eabd0 100644 --- a/build.gradle +++ b/build.gradle @@ -53,6 +53,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.cloud:spring-cloud-starter-openfeign:4.1.3' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' //swagger implementation "org.springdoc:springdoc-openapi-starter-common:${openApiVersion}" @@ -71,6 +72,9 @@ dependencies { //keycloak implementation 'org.keycloak:keycloak-admin-client:25.0.2' + //Database + implementation 'com.h2database:h2:2.2.224' + implementation 'org.postgresql:postgresql' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' From a2b933771edea3c82ef7d560edbf570133370f2b Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Mon, 17 Feb 2025 15:14:55 +0100 Subject: [PATCH 2/9] feat: Create Storage Interface --- .../wallet/stub/bdrs/BDRSService.java | 6 +- .../stub/credential/CredentialService.java | 18 +-- .../wallet/stub/did/DidController.java | 6 +- .../wallet/stub/did/DidDocumentService.java | 8 +- .../stub/issuer/IssuerCredentialService.java | 14 +- .../tractusx/wallet/stub/key/KeyService.java | 8 +- .../StatusListCredentialController.java | 6 +- .../StatusListCredentialService.java | 6 +- .../wallet/stub/storage/DatabaseStorage.java | 90 +++++++++++++ .../wallet/stub/storage/MemoryStorage.java | 4 +- .../tractusx/wallet/stub/storage/Storage.java | 120 ++++++++++++++++++ src/main/resources/application.yaml | 2 + .../wallet/stub/issuer/IssuerTest.java | 12 +- .../wallet/stub/wallet/WalletTest.java | 26 ++-- 14 files changed, 270 insertions(+), 56 deletions(-) create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/bdrs/BDRSService.java b/src/main/java/org/eclipse/tractusx/wallet/stub/bdrs/BDRSService.java index 66e049c..468799d 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/bdrs/BDRSService.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/bdrs/BDRSService.java @@ -29,7 +29,7 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.tractusx.wallet.stub.did.DidDocumentService; import org.eclipse.tractusx.wallet.stub.exception.VPValidationFailedException; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.token.TokenService; import org.eclipse.tractusx.wallet.stub.utils.StringPool; import org.springframework.stereotype.Service; @@ -43,7 +43,7 @@ @Slf4j public class BDRSService { - private final MemoryStorage memoryStorage; + private final Storage storage; private final DidDocumentService didDocumentService; private final TokenService tokenService; @@ -57,7 +57,7 @@ public Map getBpnDirectory(String jwtToken, String bpnString) { Map response = new HashMap<>(); - memoryStorage.getAllDidDocumentMap().forEach((bpn, didDocument) -> response.put(bpn, didDocument.getId())); + storage.getAllDidDocumentMap().forEach((bpn, didDocument) -> response.put(bpn, didDocument.getId())); //if bpnString is not empty, return only specific BPNs if (StringUtils.isNoneBlank(bpnString)) { diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/credential/CredentialService.java b/src/main/java/org/eclipse/tractusx/wallet/stub/credential/CredentialService.java index fca9265..fd7ac61 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/credential/CredentialService.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/credential/CredentialService.java @@ -31,7 +31,7 @@ import org.eclipse.tractusx.wallet.stub.did.DidDocument; import org.eclipse.tractusx.wallet.stub.did.DidDocumentService; import org.eclipse.tractusx.wallet.stub.key.KeyService; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.token.TokenSettings; import org.eclipse.tractusx.wallet.stub.utils.CommonUtils; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; @@ -53,7 +53,7 @@ public class CredentialService { - private final MemoryStorage memoryStorage; + private final Storage storage; private final KeyService keyService; @@ -77,7 +77,7 @@ public class CredentialService { @SneakyThrows public String getVerifiableCredentialByHolderBpnAndTypeAsJwt(String holderBpn, String type) { - Optional optionalVC = memoryStorage.getCredentialsAsJwtByHolderBpnAndType(holderBpn, type); + Optional optionalVC = storage.getCredentialsAsJwtByHolderBpnAndType(holderBpn, type); if (optionalVC.isPresent()) { return optionalVC.get(); } @@ -106,7 +106,7 @@ public String getVerifiableCredentialByHolderBpnAndTypeAsJwt(String holderBpn, S SignedJWT vcJWT = CommonUtils.signedJWT(tokenBody, issuerKeyPair, issuerDocument.getVerificationMethod().getFirst().getId()); String vcAsJwt = vcJWT.serialize(); - memoryStorage.saveCredentialAsJwt(verifiableCredential.get(StringPool.ID).toString(), vcAsJwt, holderBpn, type); + storage.saveCredentialAsJwt(verifiableCredential.get(StringPool.ID).toString(), vcAsJwt, holderBpn, type); return vcAsJwt; } @@ -121,7 +121,7 @@ public String getVerifiableCredentialByHolderBpnAndTypeAsJwt(String holderBpn, S */ @SneakyThrows public CustomCredential getVerifiableCredentialByHolderBpnAndType(String holderBpn, String type) { - Optional verifiableCredentialOptional = memoryStorage.getCredentialsByHolderBpnAndType(holderBpn, type); + Optional verifiableCredentialOptional = storage.getCredentialsByHolderBpnAndType(holderBpn, type); if (verifiableCredentialOptional.isPresent()) { return verifiableCredentialOptional.get(); } else { @@ -167,7 +167,7 @@ public CustomCredential issueStatusListCredential(String holderBpn, String vcId) vcIdUri.toString(), StringPool.STATUS_LIST_2021_CREDENTIAL, DateUtils.addYears(new Date(), 1), subject); - memoryStorage.saveCredentials(vcIdUri.toString(), credentialWithoutProof, holderBpn, StringPool.STATUS_LIST_2021_CREDENTIAL); + storage.saveCredentials(vcIdUri.toString(), credentialWithoutProof, holderBpn, StringPool.STATUS_LIST_2021_CREDENTIAL); return credentialWithoutProof; } @@ -178,7 +178,7 @@ private CustomCredential issueMembershipCredential(String holderBpn, DidDocument subject.put(StringPool.MEMBER_OF, "Catena-X"); CustomCredential credentialWithoutProof = CommonUtils.createCredential(issuerDocument.getId(), vcIdUri.toString(), StringPool.MEMBERSHIP_CREDENTIAL, DateUtils.addYears(new Date(), 1), subject); - memoryStorage.saveCredentials(vcId, credentialWithoutProof, holderBpn, StringPool.MEMBERSHIP_CREDENTIAL); + storage.saveCredentials(vcId, credentialWithoutProof, holderBpn, StringPool.MEMBERSHIP_CREDENTIAL); return credentialWithoutProof; } @@ -190,7 +190,7 @@ private CustomCredential issueBpnCredential(String holderBpn, DidDocument issuer CustomCredential credentialWithoutProof = CommonUtils.createCredential(issuerDocument.getId(), vcIdUri.toString(), StringPool.BPN_CREDENTIAL, DateUtils.addYears(new Date(), 1), subject); - memoryStorage.saveCredentials(vcId, credentialWithoutProof, holderBpn, StringPool.BPN_CREDENTIAL); + storage.saveCredentials(vcId, credentialWithoutProof, holderBpn, StringPool.BPN_CREDENTIAL); return credentialWithoutProof; } @@ -205,7 +205,7 @@ private CustomCredential issueDataExchangeGovernanceCredential(String holderBpn, CustomCredential credentialWithoutProof = CommonUtils.createCredential(issuerDocument.getId(), vcIdUri.toString(), StringPool.DATA_EXCHANGE_CREDENTIAL, DateUtils.addYears(new Date(), 1), subject); - memoryStorage.saveCredentials(vcId, credentialWithoutProof, holderBpn, StringPool.DATA_EXCHANGE_CREDENTIAL); + storage.saveCredentials(vcId, credentialWithoutProof, holderBpn, StringPool.DATA_EXCHANGE_CREDENTIAL); return credentialWithoutProof; } } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidController.java b/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidController.java index 8fecfb8..22576e8 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidController.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidController.java @@ -26,7 +26,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.wallet.stub.apidoc.DidApiDoc; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.utils.StringPool; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -45,7 +45,7 @@ public class DidController { private final DidDocumentService didDocumentService; - private final MemoryStorage memoryStorage; + private final Storage storage; /** * Retrieves the Decentralized Identifier (DID) document associated with the provided business partner number (bpn) from the memory store. @@ -57,7 +57,7 @@ public class DidController { @GetMapping(path = "{bpn}/did.json", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity getDocument(@PathVariable(name = StringPool.BPN) String bpn) { log.debug("Did document requested for bpn ->{}", bpn); - Optional didDocument = memoryStorage.getDidDocument(bpn); + Optional didDocument = storage.getDidDocument(bpn); return didDocument.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.ok(didDocumentService.getDidDocument(bpn))); } } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidDocumentService.java b/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidDocumentService.java index 98d207e..1efcba8 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidDocumentService.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/did/DidDocumentService.java @@ -32,7 +32,7 @@ import org.eclipse.edc.security.token.jwt.CryptoConverter; import org.eclipse.tractusx.wallet.stub.config.WalletStubSettings; import org.eclipse.tractusx.wallet.stub.key.KeyService; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.utils.CommonUtils; import org.eclipse.tractusx.wallet.stub.utils.StringPool; import org.springframework.stereotype.Service; @@ -52,11 +52,11 @@ public class DidDocumentService { private final WalletStubSettings walletStubSettings; - private final MemoryStorage memoryStorage; + private final Storage storage; @SneakyThrows public DidDocument getDidDocument(String issuerBpn) { - Optional optionalDidDocument = memoryStorage.getDidDocument(issuerBpn); + Optional optionalDidDocument = storage.getDidDocument(issuerBpn); if (optionalDidDocument.isPresent()) { return optionalDidDocument.get(); } @@ -93,7 +93,7 @@ public DidDocument getDidDocument(String issuerBpn) { .verificationMethod(List.of(verificationMethod)) .context(List.of("https://www.w3.org/ns/did/v1")) .build(); - memoryStorage.saveDidDocument(issuerBpn, didDocument); + storage.saveDidDocument(issuerBpn, didDocument); return didDocument; } } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerCredentialService.java b/src/main/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerCredentialService.java index a36c348..0d92407 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerCredentialService.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerCredentialService.java @@ -41,7 +41,7 @@ import org.eclipse.tractusx.wallet.stub.issuer.dto.GetCredentialsResponse; import org.eclipse.tractusx.wallet.stub.issuer.dto.IssueCredentialRequest; import org.eclipse.tractusx.wallet.stub.key.KeyService; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.token.TokenSettings; import org.eclipse.tractusx.wallet.stub.utils.CommonUtils; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; @@ -69,7 +69,7 @@ public class IssuerCredentialService { private final KeyService keyService; private final DidDocumentService didDocumentService; - private final MemoryStorage memoryStorage; + private final Storage storage; private final TokenSettings tokenSettings; @SuppressWarnings("unchecked") @@ -162,10 +162,10 @@ public Map issueCredential(IssueCredentialRequest request, Strin String vcAsJwt = vcJWT.serialize(); //save JWT - memoryStorage.saveCredentialAsJwt(vcIdUri.toString(), vcAsJwt, holderBpn, type); + storage.saveCredentialAsJwt(vcIdUri.toString(), vcAsJwt, holderBpn, type); //save JSON-LD - memoryStorage.saveCredentials(vcIdUri.toString(), verifiableCredential, holderBpn, type); + storage.saveCredentials(vcIdUri.toString(), verifiableCredential, holderBpn, type); if (!CollectionUtils.isEmpty(request.getCredentialPayload().getIssueWithSignature())) { return Map.of(StringPool.ID, vcId, StringPool.JWT, vcAsJwt); @@ -178,18 +178,18 @@ public Map issueCredential(IssueCredentialRequest request, Strin public Optional signCredential(String credentialId) { DidDocument issuerDidDocument = didDocumentService.getDidDocument(walletStubSettings.baseWalletBPN()); URI vcIdUri = URI.create(issuerDidDocument.getId() + StringPool.HASH_SEPARATOR + credentialId); - return memoryStorage.getCredentialAsJwt(vcIdUri.toString()); + return storage.getCredentialAsJwt(vcIdUri.toString()); } @SneakyThrows public GetCredentialsResponse getCredential(String externalCredentialId) { DidDocument issuerDidDocument = didDocumentService.getDidDocument(walletStubSettings.baseWalletBPN()); URI vcIdUri = URI.create(issuerDidDocument.getId() + StringPool.HASH_SEPARATOR + externalCredentialId); - Optional jwtVc = memoryStorage.getCredentialAsJwt(vcIdUri.toString()); + Optional jwtVc = storage.getCredentialAsJwt(vcIdUri.toString()); if (jwtVc.isEmpty()) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No credential found for credentialId -> " + externalCredentialId); } - Optional optionalCustomVerifiableCredential = memoryStorage.getVerifiableCredentials(vcIdUri.toString()); + Optional optionalCustomVerifiableCredential = storage.getVerifiableCredentials(vcIdUri.toString()); if (optionalCustomVerifiableCredential.isEmpty()) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No credential found for credentialId -> " + externalCredentialId); diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/key/KeyService.java b/src/main/java/org/eclipse/tractusx/wallet/stub/key/KeyService.java index d59afc9..c9eba39 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/key/KeyService.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/key/KeyService.java @@ -24,7 +24,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.wallet.stub.config.WalletStubSettings; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.utils.DeterministicECKeyPairGenerator; import org.springframework.stereotype.Service; @@ -39,7 +39,7 @@ @RequiredArgsConstructor public class KeyService { - private final MemoryStorage memoryStorage; + private final Storage storage; private final WalletStubSettings walletStubSettings; @@ -50,10 +50,10 @@ public class KeyService { * @return the KeyPair associated with the provided bpn, or generates a new KeyPair and saves it if no KeyPair is found */ public KeyPair getKeyPair(String bpn) { - Optional optionalKeyPair = memoryStorage.getKeyPair(bpn); + Optional optionalKeyPair = storage.getKeyPair(bpn); return optionalKeyPair.orElseGet(() -> { KeyPair keyPair = DeterministicECKeyPairGenerator.createKeyPair(bpn, walletStubSettings.env()); - memoryStorage.saveKeyPair(bpn, keyPair); + storage.saveKeyPair(bpn, keyPair); return keyPair; }); } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialController.java b/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialController.java index d69b4f6..be8afd9 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialController.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialController.java @@ -27,7 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.wallet.stub.apidoc.StatusListApiDoc; import org.eclipse.tractusx.wallet.stub.did.DidDocumentService; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; import org.eclipse.tractusx.wallet.stub.utils.StringPool; import org.springframework.http.HttpStatus; @@ -49,7 +49,7 @@ @Tag(name = "Status list credential") public class StatusListCredentialController { - private final MemoryStorage memoryStorage; + private final Storage storage; private final DidDocumentService didDocumentService; @@ -67,7 +67,7 @@ public ResponseEntity getStatusListVc(@PathVariable(name = "bp //currently we are returning one VC URI vcIdUri = URI.create(didDocumentService.getDidDocument(bpn).getId() + StringPool.HASH_SEPARATOR + vcId); - Optional verifiableCredentials = memoryStorage.getVerifiableCredentials(vcIdUri.toString()); + Optional verifiableCredentials = storage.getVerifiableCredentials(vcIdUri.toString()); if (verifiableCredentials.isPresent()) { return ResponseEntity.ok(verifiableCredentials.get()); } else { diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialService.java b/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialService.java index f4147b4..f5b92ae 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialService.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/statuslist/StatusListCredentialService.java @@ -28,7 +28,7 @@ import org.eclipse.tractusx.wallet.stub.credential.CredentialService; import org.eclipse.tractusx.wallet.stub.did.DidDocument; import org.eclipse.tractusx.wallet.stub.did.DidDocumentService; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; import org.eclipse.tractusx.wallet.stub.utils.StringPool; import org.springframework.stereotype.Service; @@ -41,7 +41,7 @@ @RequiredArgsConstructor public class StatusListCredentialService { - private final MemoryStorage memoryStorage; + private final Storage storage; private final DidDocumentService didDocumentService; @@ -59,7 +59,7 @@ public class StatusListCredentialService { public CustomCredential getStatusListCredential(String bpn, String vcId) { DidDocument issuerDidDocument = didDocumentService.getDidDocument(bpn); URI vcIdUri = URI.create(issuerDidDocument.getId() + StringPool.HASH_SEPARATOR + vcId); - Optional verifiableCredentials = memoryStorage.getVerifiableCredentials(vcIdUri.toString()); + Optional verifiableCredentials = storage.getVerifiableCredentials(vcIdUri.toString()); return verifiableCredentials.orElseGet(() -> credentialService.issueStatusListCredential(bpn, vcId)); } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java new file mode 100644 index 0000000..eb87bfc --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java @@ -0,0 +1,90 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.storage; + +import org.eclipse.tractusx.wallet.stub.did.DidDocument; +import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Service; + +import java.security.KeyPair; +import java.util.Map; +import java.util.Optional; + +@Service +@Profile("database") +public class DatabaseStorage implements Storage{ + @Override + public Map getAllDidDocumentMap() { + return Map.of(); + } + + @Override + public void saveCredentialAsJwt(String vcId, String jwt, String holderBPn, String type) { + + } + + @Override + public Optional getCredentialAsJwt(String vcId) { + return Optional.empty(); + } + + @Override + public void saveCredentials(String vcId, CustomCredential credential, String holderBpn, String type) { + + } + + @Override + public Optional getCredentialsByHolderBpnAndType(String holderBpn, String type) { + return Optional.empty(); + } + + @Override + public Optional getCredentialsAsJwtByHolderBpnAndType(String holderBpn, String type) { + return Optional.empty(); + } + + @Override + public Optional getVerifiableCredentials(String vcId) { + return Optional.empty(); + } + + @Override + public void saveKeyPair(String bpn, KeyPair keyPair) { + + } + + @Override + public void saveDidDocument(String bpn, DidDocument didDocument) { + + } + + @Override + public Optional getKeyPair(String bpn) { + return Optional.empty(); + } + + @Override + public Optional getDidDocument(String bpn) { + return Optional.empty(); + } +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/MemoryStorage.java b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/MemoryStorage.java index 02eb146..fc0bdc5 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/MemoryStorage.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/MemoryStorage.java @@ -23,6 +23,7 @@ import org.eclipse.tractusx.wallet.stub.did.DidDocument; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; +import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import java.security.KeyPair; @@ -34,7 +35,8 @@ * The in-memory storage */ @Service -public class MemoryStorage { +@Profile("in-memory") +public class MemoryStorage implements Storage { //To store KeyPair: BPN as a key and keypair as value diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java new file mode 100644 index 0000000..e8ab454 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java @@ -0,0 +1,120 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.storage; + +import org.eclipse.tractusx.wallet.stub.did.DidDocument; +import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; + +import java.security.KeyPair; +import java.util.Map; +import java.util.Optional; + +public interface Storage { + + + private static String getMapKey(String holderBpn, String type) { + return holderBpn + "###" + type; + } + + + /** + * Retrieves a map of all DID Documents stored in the memory storage. + * + * @return A Map containing the Business Partner Numbers (bpn) as keys and their corresponding DID Documents as values. + * If no DID Documents are found, returns an empty Map. + */ + public Map getAllDidDocumentMap(); + + /** + * Saves the provided JWT credential as a Verifiable Credential (vcId) in the memory store. + * + * @param vcId The Verifiable Credential ID associated with the JWT credential. + * @param jwt The JWT credential to be saved. + */ + public void saveCredentialAsJwt(String vcId, String jwt, String holderBPn, String type); + + /** + * Retrieves the JWT credential associated with the provided Verifiable Credential ID (vcId). + * + * @param vcId The Verifiable Credential ID. + * @return An Optional containing the JWT credential associated with the provided vcId if found, otherwise an empty Optional. + */ + public Optional getCredentialAsJwt(String vcId); + + + /** + * Saves the provided Verifiable Credential in the memory store associated with the Business Partner Number (bpn). + * + * @param vcId Credential id. + * @param credential The Verifiable Credential to be saved. + */ + public void saveCredentials(String vcId, CustomCredential credential, String holderBpn, String type); + + public Optional getCredentialsByHolderBpnAndType(String holderBpn, String type); + + public Optional getCredentialsAsJwtByHolderBpnAndType(String holderBpn, String type); + + + /** + * Retrieves the Verifiable Credential associated with the provided Verifiable Credential ID (vcId). + * + * @param vcId The Verifiable Credential ID. + * @return An Optional containing the Verifiable Credential associated with the provided vcId if found, otherwise an empty Optional. + */ + public Optional getVerifiableCredentials(String vcId); + + + /** + * Saves the provided KeyPair in the memory storage associated with the Business Partner Number (bpn). + * + * @param bpn The Business Partner Number for which the KeyPair is being saved. + * @param keyPair The KeyPair to be saved. + */ + public void saveKeyPair(String bpn, KeyPair keyPair); + + + /** + * Saves the provided DID Document in the memory storage associated with the Business Partner Number (bpn). + * + * @param bpn The Business Partner Number (bpn) for which the DID Document is saved. + * @param didDocument The DID Document to be saved. + */ + public void saveDidDocument(String bpn, DidDocument didDocument); + + + /** + * Retrieves a KeyPair associated with the provided Business Partner Number (bpn). + * + * @param bpn the Business Partner Number + * @return an Optional containing the KeyPair associated with the provided bpn if found, otherwise an empty Optional + */ + public Optional getKeyPair(String bpn); + + + /** + * Retrieves the DID Document associated with the provided Business Partner Number (bpn) from the memory store. + * + * @param bpn The business partner number (bpn) for which to retrieve the DID Document. + * @return An Optional containing the DID Document associated with the provided bpn. If no DID Document is found, return an empty Optional. + */ + public Optional getDidDocument(String bpn); +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 70e6f91..70de788 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -28,6 +28,8 @@ spring: enabled: true application: name: SSI DIM Wallet stub + profiles: + active: ${STORAGE_TYPE:in-memory} #Two options: in-memory(MemoryStorage) and database(DatabaseMemory) springdoc: swagger-ui: diff --git a/src/test/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerTest.java b/src/test/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerTest.java index 0bdc36b..e4315a2 100644 --- a/src/test/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerTest.java +++ b/src/test/java/org/eclipse/tractusx/wallet/stub/issuer/IssuerTest.java @@ -37,7 +37,7 @@ import org.eclipse.tractusx.wallet.stub.issuer.dto.SignCredentialRequest; import org.eclipse.tractusx.wallet.stub.issuer.dto.SignCredentialResponse; import org.eclipse.tractusx.wallet.stub.issuer.dto.StoreRequestDerive; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.token.TokenService; import org.eclipse.tractusx.wallet.stub.token.TokenSettings; import org.eclipse.tractusx.wallet.stub.utils.CommonUtils; @@ -79,7 +79,7 @@ class IssuerTest { private WalletStubSettings walletStubSettings; @Autowired - private MemoryStorage memoryStorage; + private Storage storage; @Autowired private DidDocumentService didDocumentService; @@ -117,8 +117,8 @@ void testCreateCredentialWithSignature() { Assertions.assertNotNull(responseBody.getJwt()); DidDocument issuerDidDocument = didDocumentService.getDidDocument(walletStubSettings.baseWalletBPN()); URI vcIdUri = URI.create(issuerDidDocument.getId() + StringPool.HASH_SEPARATOR + responseBody.getId()); - Assertions.assertTrue(memoryStorage.getCredentialAsJwt(vcIdUri.toString()).isPresent()); - Assertions.assertTrue(memoryStorage.getVerifiableCredentials(vcIdUri.toString()).isPresent()); + Assertions.assertTrue(storage.getCredentialAsJwt(vcIdUri.toString()).isPresent()); + Assertions.assertTrue(storage.getVerifiableCredentials(vcIdUri.toString()).isPresent()); } @SneakyThrows @@ -138,8 +138,8 @@ void testCreateCredential() { Assertions.assertNotNull(responseBody.getId()); DidDocument issuerDidDocument = didDocumentService.getDidDocument(walletStubSettings.baseWalletBPN()); URI vcIdUri = URI.create(issuerDidDocument.getId() + StringPool.HASH_SEPARATOR + responseBody.getId()); - Assertions.assertTrue(memoryStorage.getCredentialAsJwt(vcIdUri.toString()).isPresent()); - Assertions.assertTrue(memoryStorage.getVerifiableCredentials(vcIdUri.toString()).isPresent()); + Assertions.assertTrue(storage.getCredentialAsJwt(vcIdUri.toString()).isPresent()); + Assertions.assertTrue(storage.getVerifiableCredentials(vcIdUri.toString()).isPresent()); } diff --git a/src/test/java/org/eclipse/tractusx/wallet/stub/wallet/WalletTest.java b/src/test/java/org/eclipse/tractusx/wallet/stub/wallet/WalletTest.java index f78d42f..e5d61ed 100644 --- a/src/test/java/org/eclipse/tractusx/wallet/stub/wallet/WalletTest.java +++ b/src/test/java/org/eclipse/tractusx/wallet/stub/wallet/WalletTest.java @@ -25,7 +25,7 @@ import org.eclipse.tractusx.wallet.stub.config.TestContextInitializer; import org.eclipse.tractusx.wallet.stub.config.WalletStubSettings; import org.eclipse.tractusx.wallet.stub.did.DidDocument; -import org.eclipse.tractusx.wallet.stub.storage.MemoryStorage; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.eclipse.tractusx.wallet.stub.utils.StringPool; import org.eclipse.tractusx.wallet.stub.utils.TestUtils; import org.junit.jupiter.api.Assertions; @@ -46,7 +46,7 @@ class WalletTest { private WalletStubSettings walletStubSettings; @Autowired - private MemoryStorage memoryStorage; + private Storage storage; @Autowired private TestRestTemplate testRestTemplate; @@ -57,13 +57,13 @@ void verifyBaseWallet() { String baseWalletBPN = walletStubSettings.baseWalletBPN(); //check keypair is generated - Assertions.assertTrue(memoryStorage.getKeyPair(baseWalletBPN).isPresent()); + Assertions.assertTrue(storage.getKeyPair(baseWalletBPN).isPresent()); //check did document is created - Assertions.assertTrue(memoryStorage.getDidDocument(baseWalletBPN).isPresent()); + Assertions.assertTrue(storage.getDidDocument(baseWalletBPN).isPresent()); //check status list VC is created - Assertions.assertTrue(memoryStorage.getCredentialsByHolderBpnAndType(baseWalletBPN, StringPool.STATUS_LIST_2021_CREDENTIAL).isPresent()); + Assertions.assertTrue(storage.getCredentialsByHolderBpnAndType(baseWalletBPN, StringPool.STATUS_LIST_2021_CREDENTIAL).isPresent()); } @@ -78,10 +78,10 @@ void testWalletCreation() { Assertions.assertNotNull(responseEntity.getBody()); //check keypair is generated - Assertions.assertTrue(memoryStorage.getKeyPair(bpn).isPresent()); + Assertions.assertTrue(storage.getKeyPair(bpn).isPresent()); //check did document is created - Assertions.assertTrue(memoryStorage.getDidDocument(bpn).isPresent()); + Assertions.assertTrue(storage.getDidDocument(bpn).isPresent()); } @Test @@ -90,13 +90,13 @@ void verifySeedWallet(){ for (String bpn: walletStubSettings.seedWalletsBPN()){ //check keypair is generated - Assertions.assertTrue(memoryStorage.getKeyPair(bpn).isPresent()); + Assertions.assertTrue(storage.getKeyPair(bpn).isPresent()); //check did document is created - Assertions.assertTrue(memoryStorage.getDidDocument(bpn).isPresent()); + Assertions.assertTrue(storage.getDidDocument(bpn).isPresent()); //check status list VC is created - Assertions.assertTrue(memoryStorage.getCredentialsByHolderBpnAndType(bpn, StringPool.STATUS_LIST_2021_CREDENTIAL).isPresent()); + Assertions.assertTrue(storage.getCredentialsByHolderBpnAndType(bpn, StringPool.STATUS_LIST_2021_CREDENTIAL).isPresent()); } } @@ -111,12 +111,12 @@ void verifyNoSeedWallet(){ } //check keypair is not generated - Assertions.assertFalse(memoryStorage.getKeyPair(bpnRand).isPresent()); + Assertions.assertFalse(storage.getKeyPair(bpnRand).isPresent()); //check did document is not created - Assertions.assertFalse(memoryStorage.getDidDocument(bpnRand).isPresent()); + Assertions.assertFalse(storage.getDidDocument(bpnRand).isPresent()); //check status list VC is not created - Assertions.assertFalse(memoryStorage.getCredentialsByHolderBpnAndType(bpnRand, StringPool.STATUS_LIST_2021_CREDENTIAL).isPresent()); + Assertions.assertFalse(storage.getCredentialsByHolderBpnAndType(bpnRand, StringPool.STATUS_LIST_2021_CREDENTIAL).isPresent()); } } From 07899f34b030f3ab06017cb27b8475e14a13ca3d Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Tue, 18 Feb 2025 17:03:00 +0100 Subject: [PATCH 3/9] feat: Create entities, repositories, and configure database setup --- .../dao/entity/CustomCredentialEntity.java | 51 +++++++ .../stub/dao/entity/DidDocumentEntity.java | 54 ++++++++ .../entity/HolderCredentialAsJWTEntity.java | 45 ++++++ .../dao/entity/HolderCredentialEntity.java | 52 +++++++ .../stub/dao/entity/JWTCredentialEntity.java | 44 ++++++ .../wallet/stub/dao/entity/KeyPairEntity.java | 54 ++++++++ .../CustomCredentialRepository.java | 35 +++++ .../dao/repository/DidDocumentRepository.java | 35 +++++ .../HolderCredentialAsJWTRepository.java | 35 +++++ .../HolderCredentialRepository.java | 35 +++++ .../repository/JWTCredentialRepository.java | 35 +++++ .../dao/repository/KeyPairRepository.java | 35 +++++ .../wallet/stub/storage/DatabaseStorage.java | 128 ++++++++++++++++-- .../tractusx/wallet/stub/storage/Storage.java | 6 - .../stub/utils/DidDocumentConverter.java | 52 +++++++ src/main/resources/application.yaml | 13 +- 16 files changed, 689 insertions(+), 20 deletions(-) create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/CustomCredentialRepository.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/DidDocumentRepository.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialAsJWTRepository.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialRepository.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/JWTCredentialRepository.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/KeyPairRepository.java create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/utils/DidDocumentConverter.java diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java new file mode 100644 index 0000000..1f28c2d --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java @@ -0,0 +1,51 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; + +@Entity +@Table(name="custom_credential") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class CustomCredentialEntity { + + @Id + private String vcId; + + @Lob + @Column(name = "credential") + private CustomCredential credential; +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java new file mode 100644 index 0000000..1f4f3b8 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java @@ -0,0 +1,54 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.eclipse.tractusx.wallet.stub.did.DidDocument; +import org.eclipse.tractusx.wallet.stub.utils.DidDocumentConverter; + +@Entity +@Table(name="did_document") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class DidDocumentEntity { + + @Id + private String bpn; + + @Lob + @Convert(converter = DidDocumentConverter.class) + @Column(name = "did_document", nullable = false) + private DidDocument didDocument; +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java new file mode 100644 index 0000000..cf497e0 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java @@ -0,0 +1,45 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.*; + +@Entity +@Table(name="holder_credential_as_jwt") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class HolderCredentialAsJWTEntity { + + @Id + @Column(name = "\"key\"") + private String key; + + @Column(name = "jwt", columnDefinition = "TEXT") + private String jwt; +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java new file mode 100644 index 0000000..44cd81b --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java @@ -0,0 +1,52 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; + +@Entity +@Table(name="holder_credential") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class HolderCredentialEntity { + + @Id + @Column(name = "\"key\"") + private String key; + + @Lob + @Column(name = "credential") + private CustomCredential credential; +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java new file mode 100644 index 0000000..5926778 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java @@ -0,0 +1,44 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import lombok.*; + +@Entity +@Table(name="jwt_credential") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class JWTCredentialEntity { + + @Id + private String vcId; + + @Column(name = "jwt", columnDefinition = "TEXT") + private String jwt; +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java new file mode 100644 index 0000000..4f58bdb --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java @@ -0,0 +1,54 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Entity +@Table(name="key_pair") +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class KeyPairEntity { + + @Id + private String bpn; + + @Lob + @Column(name = "public_key", nullable = false) + private String publicKey; + + @Lob + @Column(name = "private_key", nullable = false) + private String privateKey; +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/CustomCredentialRepository.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/CustomCredentialRepository.java new file mode 100644 index 0000000..99dfab7 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/CustomCredentialRepository.java @@ -0,0 +1,35 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.repository; + +import feign.Param; +import org.eclipse.tractusx.wallet.stub.dao.entity.CustomCredentialEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +@Repository +public interface CustomCredentialRepository extends JpaRepository { + + @Query("SELECT c FROM CustomCredentialEntity c WHERE c.vcId = :vcId") + CustomCredentialEntity findByVcId(@Param("vcId") String vcId); +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/DidDocumentRepository.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/DidDocumentRepository.java new file mode 100644 index 0000000..d2bf7d4 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/DidDocumentRepository.java @@ -0,0 +1,35 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.repository; + +import feign.Param; +import org.eclipse.tractusx.wallet.stub.dao.entity.DidDocumentEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +@Repository +public interface DidDocumentRepository extends JpaRepository { + + @Query("SELECT d FROM DidDocumentEntity d WHERE d.bpn = :bpn") + DidDocumentEntity findByBpn(@Param("bpn") String bpn); +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialAsJWTRepository.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialAsJWTRepository.java new file mode 100644 index 0000000..eee104c --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialAsJWTRepository.java @@ -0,0 +1,35 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.repository; + +import feign.Param; +import org.eclipse.tractusx.wallet.stub.dao.entity.HolderCredentialAsJWTEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +@Repository +public interface HolderCredentialAsJWTRepository extends JpaRepository { + + @Query("SELECT h FROM HolderCredentialAsJWTEntity h WHERE h.key = :key") + HolderCredentialAsJWTEntity findByKey(@Param("key") String key); +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialRepository.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialRepository.java new file mode 100644 index 0000000..e97fdcf --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/HolderCredentialRepository.java @@ -0,0 +1,35 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.repository; + +import feign.Param; +import org.eclipse.tractusx.wallet.stub.dao.entity.HolderCredentialEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +@Repository +public interface HolderCredentialRepository extends JpaRepository { + + @Query("SELECT h FROM HolderCredentialEntity h WHERE h.key = :key") + HolderCredentialEntity findByKey(@Param("key") String key); +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/JWTCredentialRepository.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/JWTCredentialRepository.java new file mode 100644 index 0000000..eba32ba --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/JWTCredentialRepository.java @@ -0,0 +1,35 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.repository; + +import feign.Param; +import org.eclipse.tractusx.wallet.stub.dao.entity.JWTCredentialEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +@Repository +public interface JWTCredentialRepository extends JpaRepository { + + @Query("SELECT jwt FROM JWTCredentialEntity jwt WHERE jwt.vcId = :vcId") + JWTCredentialEntity findByVcId(@Param("vcId") String vcId); +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/KeyPairRepository.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/KeyPairRepository.java new file mode 100644 index 0000000..14135b5 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/repository/KeyPairRepository.java @@ -0,0 +1,35 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.dao.repository; + +import feign.Param; +import org.eclipse.tractusx.wallet.stub.dao.entity.KeyPairEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +@Repository +public interface KeyPairRepository extends JpaRepository { + + @Query("SELECT k FROM KeyPairEntity k WHERE k.bpn = :bpn") + KeyPairEntity findByBpn(@Param("bpn") String bpn); +} diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java index eb87bfc..48bf4b6 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/DatabaseStorage.java @@ -21,70 +21,172 @@ package org.eclipse.tractusx.wallet.stub.storage; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.tractusx.wallet.stub.dao.entity.CustomCredentialEntity; +import org.eclipse.tractusx.wallet.stub.dao.entity.DidDocumentEntity; +import org.eclipse.tractusx.wallet.stub.dao.entity.HolderCredentialAsJWTEntity; +import org.eclipse.tractusx.wallet.stub.dao.entity.HolderCredentialEntity; +import org.eclipse.tractusx.wallet.stub.dao.entity.JWTCredentialEntity; +import org.eclipse.tractusx.wallet.stub.dao.entity.KeyPairEntity; +import org.eclipse.tractusx.wallet.stub.dao.repository.*; import org.eclipse.tractusx.wallet.stub.did.DidDocument; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; +import java.security.KeyFactory; import java.security.KeyPair; -import java.util.Map; -import java.util.Optional; - +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +@Slf4j @Service +@RequiredArgsConstructor @Profile("database") public class DatabaseStorage implements Storage{ + + private final KeyPairRepository keyPairRepository; + + private final DidDocumentRepository didDocumentRepository; + + private final CustomCredentialRepository customCredentialRepository; + + private final JWTCredentialRepository jwtCredentialRepository; + + private final HolderCredentialRepository holderCredentialRepository; + + private final HolderCredentialAsJWTRepository holderCredentialAsJWTRepository; + + + private static String getMapKey(String holderBpn, String type) { + return holderBpn + "###" + type; + } + @Override public Map getAllDidDocumentMap() { - return Map.of(); + List didDocumentEntityList = didDocumentRepository.findAll(); + Map allDidDocumentMap = new ConcurrentHashMap<>(); + for(DidDocumentEntity didDocumentEntity: didDocumentEntityList){ + DidDocument didDocument = didDocumentEntity.getDidDocument(); + allDidDocumentMap.put(didDocumentEntity.getBpn(), didDocument); + } + return allDidDocumentMap; } @Override public void saveCredentialAsJwt(String vcId, String jwt, String holderBPn, String type) { - + String key = getMapKey(holderBPn, type); + holderCredentialAsJWTRepository.save(new HolderCredentialAsJWTEntity(key, jwt)); + if(jwtCredentialRepository.findByVcId(vcId) == null){ + jwtCredentialRepository.save(new JWTCredentialEntity(vcId, jwt)); + } } @Override public Optional getCredentialAsJwt(String vcId) { - return Optional.empty(); + JWTCredentialEntity jwtCredentialEntity = jwtCredentialRepository.findByVcId(vcId); + if(jwtCredentialEntity == null){ + return Optional.empty(); + } + return Optional.ofNullable(jwtCredentialEntity.getJwt()); } @Override public void saveCredentials(String vcId, CustomCredential credential, String holderBpn, String type) { - + String key = getMapKey(holderBpn, type); + holderCredentialRepository.save(new HolderCredentialEntity(key,credential)); + if(customCredentialRepository.findByVcId(vcId) == null){ + customCredentialRepository.save(new CustomCredentialEntity(vcId,credential)); + } } @Override public Optional getCredentialsByHolderBpnAndType(String holderBpn, String type) { - return Optional.empty(); + HolderCredentialEntity holderCredentialEntity = holderCredentialRepository.findByKey(getMapKey(holderBpn, type)); + if(holderCredentialEntity == null){ + return Optional.empty(); + } + return Optional.ofNullable(holderCredentialEntity.getCredential()); } @Override public Optional getCredentialsAsJwtByHolderBpnAndType(String holderBpn, String type) { - return Optional.empty(); + HolderCredentialAsJWTEntity holderCredentialAsJWTEntity = holderCredentialAsJWTRepository.findByKey(getMapKey(holderBpn,type)); + if(holderCredentialAsJWTEntity == null){ + return Optional.empty(); + } + return Optional.ofNullable(holderCredentialAsJWTEntity.getJwt()); } @Override public Optional getVerifiableCredentials(String vcId) { - return Optional.empty(); + CustomCredentialEntity customCredentialEntity = customCredentialRepository.findByVcId(vcId); + if(customCredentialEntity == null){ + return Optional.empty(); + } + return Optional.ofNullable(customCredentialEntity.getCredential()); } @Override public void saveKeyPair(String bpn, KeyPair keyPair) { - + try { + // Convert keys to Base64 strings (or byte arrays if preferred) + String privateKeyBase64 = Base64.getEncoder().encodeToString(keyPair.getPrivate().getEncoded()); + String publicKeyBase64 = Base64.getEncoder().encodeToString(keyPair.getPublic().getEncoded()); + + KeyPairEntity keyPairEntity = new KeyPairEntity(bpn, publicKeyBase64, privateKeyBase64); + keyPairRepository.save(keyPairEntity); + } catch (Exception e) { + log.error("Error saving KeyPair for BPN {}: {}", bpn, e.getMessage()); + } } @Override public void saveDidDocument(String bpn, DidDocument didDocument) { + didDocumentRepository.save(new DidDocumentEntity(bpn, didDocument)); } @Override public Optional getKeyPair(String bpn) { - return Optional.empty(); + try { + // Retrieve the KeyPairEntity from the database + KeyPairEntity keyPairEntity = keyPairRepository.findByBpn(bpn); + + if (keyPairEntity != null) { + // Decode the Base64 strings into byte arrays + byte[] privateKeyBytes = Base64.getDecoder().decode(keyPairEntity.getPrivateKey()); + byte[] publicKeyBytes = Base64.getDecoder().decode(keyPairEntity.getPublicKey()); + + // Recreate the private and public keys from the byte arrays + PrivateKey privateKey = KeyFactory.getInstance("EC").generatePrivate(new PKCS8EncodedKeySpec(privateKeyBytes)); + PublicKey publicKey = KeyFactory.getInstance("EC").generatePublic(new X509EncodedKeySpec(publicKeyBytes)); + + return Optional.of(new KeyPair(publicKey, privateKey)); + } else { + log.warn("KeyPair not found for BPN: {}", bpn); + return Optional.empty(); + } + } catch (Exception e) { + log.error("Error retrieving KeyPair for BPN {}: {}", bpn, e.getMessage()); + return Optional.empty(); + } + } @Override public Optional getDidDocument(String bpn) { - return Optional.empty(); + DidDocumentEntity didDocumentEntity = didDocumentRepository.findByBpn(bpn); + if(didDocumentEntity == null){ + return Optional.empty(); + } + return Optional.ofNullable(didDocumentEntity.getDidDocument()); } + } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java index e8ab454..5966336 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/storage/Storage.java @@ -30,12 +30,6 @@ public interface Storage { - - private static String getMapKey(String holderBpn, String type) { - return holderBpn + "###" + type; - } - - /** * Retrieves a map of all DID Documents stored in the memory storage. * diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/utils/DidDocumentConverter.java b/src/main/java/org/eclipse/tractusx/wallet/stub/utils/DidDocumentConverter.java new file mode 100644 index 0000000..54aa0c8 --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/utils/DidDocumentConverter.java @@ -0,0 +1,52 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.utils; + +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.persistence.AttributeConverter; +import org.eclipse.tractusx.wallet.stub.did.DidDocument; + +import java.io.IOException; + +public class DidDocumentConverter implements AttributeConverter { + + private static final ObjectMapper objectMapper = new ObjectMapper(); + + + @Override + public String convertToDatabaseColumn(DidDocument didDocument) { + try{ + return objectMapper.writeValueAsString(didDocument); + }catch (IOException e){ + throw new IllegalArgumentException("Error converting DidDocument to JSON", e); + } + } + + @Override + public DidDocument convertToEntityAttribute(String json) { + try{ + return objectMapper.readValue(json, DidDocument.class); + }catch (IOException e){ + throw new IllegalArgumentException("Error converting JSON to DidDocument", e); + } + } +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 70de788..779ff70 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -29,7 +29,18 @@ spring: application: name: SSI DIM Wallet stub profiles: - active: ${STORAGE_TYPE:in-memory} #Two options: in-memory(MemoryStorage) and database(DatabaseMemory) + active: ${STORAGE_TYPE:database} #Two options: in-memory(MemoryStorage) and database(DatabaseMemory) + datasource: + url: ${SPRING_DATASOURCE_URL:jdbc:h2:mem:testdb} + username: ${SPRING_DATASOURCE_USERNAME:sa} + password: ${SPRING_DATASOURCE_PASSWORD:} + driver-class-name: ${SPRING_DATASOURCE_DRIVER_CLASS_NAME:org.h2.Driver} + jpa: + properties: + hibernates: + cache: + use_second_level_cache: false + use_query_cache: false springdoc: swagger-ui: From 9d8f7900e82fc19491e08755ba1fbd913fca3d8f Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Tue, 18 Feb 2025 17:13:35 +0100 Subject: [PATCH 4/9] chore: Update DEPENDENCIES --- DEPENDENCIES | 104 ++++++++++++++++++++++----------------------------- 1 file changed, 45 insertions(+), 59 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index 48d29b8..d249b5b 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -4,35 +4,18 @@ maven/mavencentral/com.apicatalog/carbon-did/0.3.0, Apache-2.0, approved, clearl maven/mavencentral/com.apicatalog/copper-multibase/0.5.0, Apache-2.0, approved, #14501 maven/mavencentral/com.apicatalog/copper-multicodec/0.1.1, Apache-2.0, approved, #14500 maven/mavencentral/com.apicatalog/iron-verifiable-credentials/0.14.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.apicatalog/titanium-json-ld/1.0.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.apicatalog/titanium-json-ld/1.4.0, Apache-2.0, approved, #15200 -maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.3, Apache-2.0, approved, #15260 -maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.16.0, Apache-2.0, approved, #11606 -maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.16.2, Apache-2.0, approved, #11606 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.17.2, Apache-2.0, approved, #13672 -maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.3, , approved, #15194 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.17.2, Apache-2.0 AND MIT, approved, #13665 -maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.11.0, Apache-2.0, approved, CQ23093 -maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.3, Apache-2.0, approved, #15199 -maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.16.0, Apache-2.0, approved, #11605 -maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.16.2, Apache-2.0, approved, #11605 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.17.2, Apache-2.0, approved, #13671 -maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.16.0, Apache-2.0, approved, #11855 -maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.16.2, Apache-2.0, approved, #11855 maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.17.2, Apache-2.0, approved, #13669 maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.17.2, Apache-2.0, approved, #15117 -maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.16.0, Apache-2.0, approved, #11853 -maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.16.2, Apache-2.0, approved, #11853 maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.17.2, Apache-2.0, approved, #14160 -maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-base/2.15.3, Apache-2.0, approved, #9235 maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-base/2.17.2, Apache-2.0, approved, #14194 -maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.15.3, Apache-2.0, approved, #9236 -maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.16.2, Apache-2.0, approved, #11858 maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.17.2, Apache-2.0, approved, #14195 -maven/mavencentral/com.fasterxml.jackson.module/jackson-module-jakarta-xmlbind-annotations/2.15.3, Apache-2.0, approved, #9241 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-jakarta-xmlbind-annotations/2.17.2, Apache-2.0, approved, #13668 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.17.2, Apache-2.0, approved, #15122 -maven/mavencentral/com.fasterxml.jackson/jackson-bom/2.17.2, Apache-2.0, approved, #14162 +maven/mavencentral/com.fasterxml/classmate/1.7.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.github.curious-odd-man/rgxgen/2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.github.java-json-tools/json-patch/1.13, Apache-2.0 OR LGPL-3.0-or-later, approved, CQ23929 maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0 and CC-BY-2.5, approved, #15220 @@ -40,6 +23,7 @@ maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159 maven/mavencentral/com.google.crypto.tink/tink/1.13.0, Apache-2.0, approved, #14502 maven/mavencentral/com.google.errorprone/error_prone_annotations/2.22.0, Apache-2.0, approved, #10661 maven/mavencentral/com.google.protobuf/protobuf-java/3.25.1, BSD-3-Clause, approved, clearlydefined +maven/mavencentral/com.h2database/h2/2.2.224, (EPL-1.0 OR MPL-2.0) AND (LGPL-3.0-or-later OR EPL-1.0 OR MPL-2.0), approved, #9322 maven/mavencentral/com.ibm.async/asyncutil/0.1.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.jayway.jsonpath/json-path/2.9.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.40, Apache-2.0, approved, #15156 @@ -48,7 +32,8 @@ maven/mavencentral/com.sun.istack/istack-commons-tools/4.1.2, BSD-3-Clause, appr maven/mavencentral/com.sun.xml.bind.external/relaxng-datatype/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl maven/mavencentral/com.sun.xml.bind.external/rngom/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 -maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 +maven/mavencentral/com.zaxxer/HikariCP/5.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/commons-codec/commons-codec/1.16.1, Apache-2.0 AND (Apache-2.0 AND BSD-3-Clause), approved, #9157 maven/mavencentral/commons-fileupload/commons-fileupload/1.5, Apache-2.0, approved, #7109 maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 maven/mavencentral/commons-logging/commons-logging/1.2, Apache-2.0, approved, CQ10162 @@ -61,43 +46,38 @@ maven/mavencentral/io.github.openfeign/feign-slf4j/13.3, Apache-2.0, approved, c maven/mavencentral/io.micrometer/micrometer-commons/1.13.2, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #14826 maven/mavencentral/io.micrometer/micrometer-core/1.13.2, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #14827 maven/mavencentral/io.micrometer/micrometer-jakarta9/1.13.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/io.micrometer/micrometer-observation/1.12.8, Apache-2.0, approved, #11680 maven/mavencentral/io.micrometer/micrometer-observation/1.13.2, Apache-2.0, approved, #14829 -maven/mavencentral/io.opentelemetry/opentelemetry-api/1.32.0, Apache-2.0, approved, #11682 +maven/mavencentral/io.opentelemetry/opentelemetry-api/1.37.0, Apache-2.0, approved, clearlydefined maven/mavencentral/io.opentelemetry/opentelemetry-context/1.37.0, Apache-2.0, approved, clearlydefined maven/mavencentral/io.setl/rdf-urdna/1.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.smallrye/jandex/3.1.2, Apache-2.0, approved, clearlydefined maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.20, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.22, Apache-2.0, approved, #5947 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.20, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.22, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-integration-jakarta/2.2.22, Apache-2.0, approved, #11475 -maven/mavencentral/io.swagger.core.v3/swagger-jaxrs2-jakarta/2.2.21, Apache-2.0, approved, #11477 maven/mavencentral/io.swagger.core.v3/swagger-jaxrs2-jakarta/2.2.22, Apache-2.0, approved, #11477 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.20, Apache-2.0, approved, #5919 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.22, Apache-2.0, approved, #5919 -maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.0, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf -maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.3, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca +maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, ee4j.cdi maven/mavencentral/jakarta.json/jakarta.json-api/2.1.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp -maven/mavencentral/jakarta.mail/jakarta.mail-api/2.1.2, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.mail +maven/mavencentral/jakarta.mail/jakarta.mail-api/2.1.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.mail +maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause, approved, ee4j.jpa +maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jta maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, ee4j.validation maven/mavencentral/jakarta.ws.rs/jakarta.ws.rs-api/3.1.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.rest -maven/mavencentral/jakarta.ws.rs/jakarta.ws.rs-api/4.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.rest -maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/3.0.1, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.2, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.12, Apache-2.0, approved, #7164 -maven/mavencentral/net.bytebuddy/byte-buddy/1.14.11, Apache-2.0 AND BSD-3-Clause, approved, #7163 -maven/mavencentral/net.bytebuddy/byte-buddy/1.14.12, Apache-2.0 AND BSD-3-Clause, approved, #7163 -maven/mavencentral/net.minidev/accessors-smart/2.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/net.minidev/json-smart/2.5.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/net.minidev/json-smart/2.5.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.apache.commons/commons-lang3/3.14.0, Apache-2.0, approved, #11677 +maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.18, Apache-2.0, approved, #7164 +maven/mavencentral/net.bytebuddy/byte-buddy/1.14.18, Apache-2.0 AND BSD-3-Clause, approved, #7163 +maven/mavencentral/net.minidev/accessors-smart/2.5.1, Apache-2.0, approved, #19432 +maven/mavencentral/net.minidev/json-smart/2.5.1, Apache-2.0, approved, #19431 +maven/mavencentral/org.antlr/antlr4-runtime/4.13.0, BSD-3-Clause, approved, #10767 maven/mavencentral/org.apache.commons/commons-lang3/3.15.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-text/1.12.0, Apache-2.0, approved, #14414 maven/mavencentral/org.apache.httpcomponents.client5/httpclient5/5.3.1, Apache-2.0, approved, #12911 -maven/mavencentral/org.apache.httpcomponents.core5/httpcore5-h2/5.2.4, Apache-2.0, approved, #10658 -maven/mavencentral/org.apache.httpcomponents.core5/httpcore5/5.2.4, Apache-2.0, approved, #9652 +maven/mavencentral/org.apache.httpcomponents.core5/httpcore5-h2/5.2.5, Apache-2.0, approved, #10658 maven/mavencentral/org.apache.httpcomponents.core5/httpcore5/5.2.5, Apache-2.0, approved, #9652 maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0, approved, #15248 maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 @@ -110,12 +90,14 @@ maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-core/10.1.26, Apache-2.0 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-el/10.1.26, Apache-2.0, approved, #6997 maven/mavencentral/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.26, Apache-2.0, approved, #7920 maven/mavencentral/org.apiguardian/apiguardian-api/1.1.2, Apache-2.0, approved, #17641 +maven/mavencentral/org.aspectj/aspectjweaver/1.9.22.1, EPL-1.0, approved, tools.aspectj maven/mavencentral/org.assertj/assertj-core/3.25.3, Apache-2.0, approved, #12585 maven/mavencentral/org.awaitility/awaitility/4.2.1, Apache-2.0, approved, #14178 maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.78, MIT AND CC0-1.0, approved, #14433 maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.78.1, MIT AND CC0-1.0, approved, #14433 -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.angus/angus-mail/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.checkerframework/checker-qual/3.42.0, MIT, approved, clearlydefined +maven/mavencentral/org.eclipse.angus/angus-activation/2.0.2, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.eclipse.angus/angus-mail/2.0.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus maven/mavencentral/org.eclipse.edc/api-configuration/0.8.1, Apache-2.0, approved, technology.edc maven/mavencentral/org.eclipse.edc/boot-spi/0.8.1, Apache-2.0, approved, technology.edc maven/mavencentral/org.eclipse.edc/core-spi/0.8.1, Apache-2.0, approved, technology.edc @@ -146,17 +128,18 @@ maven/mavencentral/org.eclipse.edc/verifiable-credentials-spi/0.8.1, Apache-2.0, maven/mavencentral/org.eclipse.edc/web-spi/0.8.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.parsson/parsson/1.1.6, EPL-2.0, approved, ee4j.parsson -maven/mavencentral/org.glassfish.jaxb/codemodel/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-jxc/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-xjc/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/xsom/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/codemodel/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-jxc/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-xjc/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/txw2/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/xsom/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp -maven/mavencentral/org.hamcrest/hamcrest/2.1, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, #17677 maven/mavencentral/org.hdrhistogram/HdrHistogram/2.2.2, BSD-2-Clause AND CC0-1.0 AND CC0-1.0, approved, #14828 +maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 +maven/mavencentral/org.hibernate.orm/hibernate-core/6.5.2.Final, LGPL-2.1-only AND (EPL-2.0 OR BSD-3-Clause) AND LGPL-2.1-or-later AND MIT, approved, #15118 maven/mavencentral/org.jacoco/org.jacoco.agent/0.8.11, EPL-2.0, approved, CQ23285 maven/mavencentral/org.jacoco/org.jacoco.ant/0.8.11, EPL-2.0, approved, #1068 maven/mavencentral/org.jacoco/org.jacoco.core/0.8.11, EPL-2.0, approved, CQ23283 @@ -172,7 +155,6 @@ maven/mavencentral/org.jboss.resteasy/resteasy-jaxb-provider/6.2.7.Final, Apache maven/mavencentral/org.jboss.resteasy/resteasy-multipart-provider/6.2.7.Final, Apache-2.0, approved, clearlydefined maven/mavencentral/org.jboss/jandex/2.4.4.Final, Apache-2.0, approved, clearlydefined maven/mavencentral/org.jetbrains/annotations/24.1.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.2, EPL-2.0, approved, #9714 maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.3, EPL-2.0, approved, #9714 maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.10.3, EPL-2.0, approved, #9711 maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.10.3, EPL-2.0, approved, #15250 @@ -180,7 +162,6 @@ maven/mavencentral/org.junit.jupiter/junit-jupiter/5.10.3, EPL-2.0, approved, #1 maven/mavencentral/org.junit.platform/junit-platform-commons/1.10.3, EPL-2.0, approved, #9715 maven/mavencentral/org.junit.platform/junit-platform-engine/1.10.3, EPL-2.0, approved, #9709 maven/mavencentral/org.junit.platform/junit-platform-launcher/1.10.3, EPL-2.0, approved, #15216 -maven/mavencentral/org.junit/junit-bom/5.10.3, EPL-2.0, approved, #9844 maven/mavencentral/org.keycloak/keycloak-admin-client/25.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.keycloak/keycloak-common/25.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.keycloak/keycloak-core/25.0.2, Apache-2.0, approved, clearlydefined @@ -192,26 +173,28 @@ maven/mavencentral/org.opentest4j/opentest4j/1.3.0, Apache-2.0, approved, #9713 maven/mavencentral/org.ow2.asm/asm-commons/9.6, BSD-3-Clause, approved, #10775 maven/mavencentral/org.ow2.asm/asm-tree/9.6, BSD-3-Clause, approved, #10773 maven/mavencentral/org.ow2.asm/asm/9.6, BSD-3-Clause, approved, #10776 +maven/mavencentral/org.postgresql/postgresql/42.7.3, BSD-2-Clause AND Apache-2.0, approved, #11681 +maven/mavencentral/org.projectlombok/lombok/1.18.34, MIT, approved, #15192 maven/mavencentral/org.reactivestreams/reactive-streams/1.0.4, CC0-1.0, approved, CQ16332 maven/mavencentral/org.skyscreamer/jsonassert/1.5.3, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.13, MIT, approved, #7698 -maven/mavencentral/org.slf4j/slf4j-api/1.7.26, MIT, approved, CQ13368 -maven/mavencentral/org.slf4j/slf4j-api/1.7.36, MIT, approved, CQ13368 -maven/mavencentral/org.slf4j/slf4j-api/2.0.11, MIT, approved, #5915 maven/mavencentral/org.slf4j/slf4j-api/2.0.13, MIT, approved, #5915 -maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.4.0, Apache-2.0, approved, #13755 maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.4.0, Apache-2.0, approved, #13748 maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.4.0, Apache-2.0, approved, #13754 maven/mavencentral/org.springframework.boot/spring-boot-actuator-autoconfigure/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-actuator/3.3.2, Apache-2.0, approved, #16976 -maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.3, Apache-2.0, approved, #11751 -maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.7, Apache-2.0, approved, #11751 maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.3.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.3.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-actuator/3.3.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.3.2, Apache-2.0, approved, #16896 +maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.3.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.3.2, Apache-2.0, approved, #16885 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.3.2, Apache-2.0, approved, #16886 +maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.3.2, Apache-2.0, approved, #16975 maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.3.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.boot/spring-boot-starter/3.2.7, Apache-2.0, approved, #11935 +maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.3.2, Apache-2.0, approved, #16893 maven/mavencentral/org.springframework.boot/spring-boot-starter/3.3.2, Apache-2.0, approved, #16895 maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-test/3.3.2, Apache-2.0, approved, clearlydefined @@ -221,20 +204,23 @@ maven/mavencentral/org.springframework.cloud/spring-cloud-context/4.1.4, Apache- maven/mavencentral/org.springframework.cloud/spring-cloud-openfeign-core/4.1.3, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.cloud/spring-cloud-starter-openfeign/4.1.3, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.cloud/spring-cloud-starter/4.1.4, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.security/spring-security-crypto/6.2.5, Apache-2.0 AND ISC, approved, #11908 +maven/mavencentral/org.springframework.data/spring-data-commons/3.3.2, Apache-2.0, approved, #15116 +maven/mavencentral/org.springframework.data/spring-data-jpa/3.3.2, Apache-2.0, approved, #15120 +maven/mavencentral/org.springframework.security/spring-security-crypto/6.3.1, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.security/spring-security-rsa/1.1.3, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework/spring-aop/6.1.11, Apache-2.0, approved, #15221 +maven/mavencentral/org.springframework/spring-aspects/6.1.11, Apache-2.0, approved, #15193 maven/mavencentral/org.springframework/spring-beans/6.1.11, Apache-2.0, approved, #15213 maven/mavencentral/org.springframework/spring-context/6.1.11, Apache-2.0, approved, #15261 maven/mavencentral/org.springframework/spring-core/6.1.11, Apache-2.0 AND BSD-3-Clause, approved, #15206 maven/mavencentral/org.springframework/spring-expression/6.1.11, Apache-2.0, approved, #15264 maven/mavencentral/org.springframework/spring-jcl/6.1.11, Apache-2.0, approved, #15266 +maven/mavencentral/org.springframework/spring-jdbc/6.1.11, Apache-2.0, approved, #15191 +maven/mavencentral/org.springframework/spring-orm/6.1.11, Apache-2.0, approved, #15278 maven/mavencentral/org.springframework/spring-test/6.1.11, Apache-2.0, approved, #15265 -maven/mavencentral/org.springframework/spring-web/5.1.5.RELEASE, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ18367 -maven/mavencentral/org.springframework/spring-web/6.1.10, Apache-2.0, approved, #15188 +maven/mavencentral/org.springframework/spring-tx/6.1.11, Apache-2.0, approved, #15229 maven/mavencentral/org.springframework/spring-web/6.1.11, Apache-2.0, approved, #15188 maven/mavencentral/org.springframework/spring-webmvc/6.1.11, Apache-2.0, approved, #15182 -maven/mavencentral/org.springframework/spring-webmvc/6.1.4, Apache-2.0, approved, #15182 maven/mavencentral/org.webjars/swagger-ui/5.11.8, Apache-2.0, approved, #13756 maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 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 From 16755752b97571f7345345ed637539d165cca54c Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Thu, 20 Feb 2025 09:43:02 +0100 Subject: [PATCH 5/9] feat: Include PostgreSQL --- charts/ssi-dim-wallet-stub/Chart.lock | 7 ++- charts/ssi-dim-wallet-stub/Chart.yaml | 8 ++- .../templates/configmap.yaml | 9 ++- .../templates/database-configmap.yaml | 30 ++++++++++ charts/ssi-dim-wallet-stub/values.yaml | 57 ++++++++++++++++++- .../dao/entity/CustomCredentialEntity.java | 12 +++- .../stub/dao/entity/DidDocumentEntity.java | 7 ++- .../entity/HolderCredentialAsJWTEntity.java | 4 +- .../dao/entity/HolderCredentialEntity.java | 13 +++-- .../stub/dao/entity/JWTCredentialEntity.java | 3 +- .../wallet/stub/dao/entity/KeyPairEntity.java | 9 ++- .../stub/utils/CustomCredentialConverter.java | 51 +++++++++++++++++ src/main/resources/application.yaml | 4 +- 13 files changed, 191 insertions(+), 23 deletions(-) create mode 100644 charts/ssi-dim-wallet-stub/templates/database-configmap.yaml create mode 100644 src/main/java/org/eclipse/tractusx/wallet/stub/utils/CustomCredentialConverter.java diff --git a/charts/ssi-dim-wallet-stub/Chart.lock b/charts/ssi-dim-wallet-stub/Chart.lock index a87ef07..590f0bf 100644 --- a/charts/ssi-dim-wallet-stub/Chart.lock +++ b/charts/ssi-dim-wallet-stub/Chart.lock @@ -2,5 +2,8 @@ dependencies: - name: centralidp repository: https://eclipse-tractusx.github.io/charts/dev version: 3.0.0 -digest: sha256:4a16133a0c3bc6fbcc85e2f307460c5ab7b6dae226de269414ae81298cb4dcac -generated: "2024-08-12T17:49:14.692969+05:30" +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 16.4.8 +digest: sha256:1dd28c9625bd7f66b3e3c009371175284e2b2ba19ab07e4f84136d93df41a784 +generated: "2025-02-19T15:56:23.152613081+01:00" diff --git a/charts/ssi-dim-wallet-stub/Chart.yaml b/charts/ssi-dim-wallet-stub/Chart.yaml index 17dff0e..1cb8e27 100644 --- a/charts/ssi-dim-wallet-stub/Chart.yaml +++ b/charts/ssi-dim-wallet-stub/Chart.yaml @@ -23,8 +23,8 @@ name: ssi-dim-wallet-stub description: | A Helm chart to deploy SSI DIM wallet stub in kubernetes cluster type: application -version: 0.1.8 -appVersion: "0.0.5" +version: 0.1.9 +appVersion: "0.0.6" home: https://github.com/eclipse-tractusx/ssi-dim-wallet-stub/tree/main/charts/ssi-dim-wallet-stub sources: - https://github.com/eclipse-tractusx/ssi-dim-wallet-stub/tree/main/charts/ssi-dim-wallet-stub @@ -33,3 +33,7 @@ dependencies: version: 3.0.0 repository: https://eclipse-tractusx.github.io/charts/dev condition: keycloak.enabled + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 16.4.8 + condition: postgresql.enabled diff --git a/charts/ssi-dim-wallet-stub/templates/configmap.yaml b/charts/ssi-dim-wallet-stub/templates/configmap.yaml index 52d8160..f1f4cd9 100644 --- a/charts/ssi-dim-wallet-stub/templates/configmap.yaml +++ b/charts/ssi-dim-wallet-stub/templates/configmap.yaml @@ -1,5 +1,5 @@ ############################################################### -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -38,3 +38,10 @@ data: PORTAL_HOST: {{ .Values.wallet.portal.host | quote }} PORTAL_REALM: {{ .Values.wallet.keycloak.realm | quote }} PORTAL_AUTH_SERVER_URL: {{ .Values.wallet.keycloak.authServerUrl | quote }} + STORAGE_TYPE: {{ .Values.wallet.storageType | quote }} + {{- if .Values.wallet.postgresql.enabled }} + SPRING_DATASOURCE_URL: {{ .Values.wallet.postgresql.url | quote }} + SPRING_DATASOURCE_USERNAME: {{ .Values.wallet.postgresql.username | quote }} + SPRING_DATASOURCE_PASSWORD: {{ .Values.wallet.postgresql.password | quote }} + SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.postgresql.Driver + {{- end }} diff --git a/charts/ssi-dim-wallet-stub/templates/database-configmap.yaml b/charts/ssi-dim-wallet-stub/templates/database-configmap.yaml new file mode 100644 index 0000000..f1e70b6 --- /dev/null +++ b/charts/ssi-dim-wallet-stub/templates/database-configmap.yaml @@ -0,0 +1,30 @@ +############################################################### +# Copyright (c) 2025 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 +############################################################### + +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.postgresql.configmap.name }} +data: + POSTGRES_SVC: {{quote .Values.postgresql.fullnameOverride }} + POSTGRES_PORT: {{quote .Values.postgresql.databasePort }} + POSTGRES_DB: {{quote .Values.postgresql.auth.database }} + POSTGRES_USER: {{quote .Values.postgresql.auth.username }} + POSTGRES_PASSWORD: {{quote .Values.postgresql.auth.password }} diff --git a/charts/ssi-dim-wallet-stub/values.yaml b/charts/ssi-dim-wallet-stub/values.yaml index ddc5f5b..09b8eb0 100644 --- a/charts/ssi-dim-wallet-stub/values.yaml +++ b/charts/ssi-dim-wallet-stub/values.yaml @@ -1,5 +1,5 @@ ############################################################### -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -136,6 +136,15 @@ wallet: realm: "CX-Central" # -- keycloak host authServerUrl: "http://localhost:28080/auth" + # --- Storage Type: in-memory (In memory storage) or database (Using database) + storageType: database + # --- PostgreSQL storage + postgresql: + # --- Enable PostgraSQL driver, otherwise H2 will be use instead + enabled: true + url: jdbc:postgresql://wallet-postgres:5432/postgres + username: postgres + password: postgrespassword # --- Service configuration service: type: ClusterIP @@ -145,3 +154,49 @@ wallet: # -- Keycloak configuration keycloak: enabled: false + +# -- PostgreSQL configuration +postgresql: + fullnameOverride: wallet-postgres + # -- Enable to deploy Postgresql + enabled: true + image: + tag: "15-debian-11" + configmap: + name: wallet-postgres-configmap + auth: + password: postgrespassword + username: postgres + primary: + persistence: + enabled: false + size: 10Gi + storageClass: standard + initdb: + scripts: + init.sql: |- + CREATE TABLE IF NOT EXISTS custom_credential( + vc_id VARCHAR(255) PRIMARY KEY, + credential VARCHAR NOT NULL + ); + CREATE TABLE IF NOT EXISTS did_document( + bpn VARCHAR(255) PRIMARY KEY, + did_document VARCHAR NOT NULL + ); + CREATE TABLE IF NOT EXISTS holder_credential( + key VARCHAR(255) PRIMARY KEY, + credential VARCHAR NOT NULL + ); + CREATE TABLE IF NOT EXISTS holder_credential_as_jwt( + jwt VARCHAR NOT NULL, + key VARCHAR(255) PRIMARY KEY + ); + CREATE TABLE IF NOT EXISTS jwt_credential( + jwt VARCHAR NOT NULL, + vc_id VARCHAR(255) PRIMARY KEY + ); + CREATE TABLE IF NOT EXISTS key_pair( + bpn VARCHAR(255) PRIMARY KEY, + private_key VARCHAR NOT NULL, + public_key VARCHAR NOT NULL + ); diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java index 1f28c2d..8c7232c 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/CustomCredentialEntity.java @@ -22,9 +22,9 @@ package org.eclipse.tractusx.wallet.stub.dao.entity; import jakarta.persistence.Column; +import jakarta.persistence.Convert; import jakarta.persistence.Entity; import jakarta.persistence.Id; -import jakarta.persistence.Lob; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -32,6 +32,10 @@ import lombok.NoArgsConstructor; import lombok.Setter; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; +import org.eclipse.tractusx.wallet.stub.utils.CustomCredentialConverter; +import org.hibernate.annotations.JdbcTypeCode; + +import java.sql.Types; @Entity @Table(name="custom_credential") @@ -43,9 +47,11 @@ public class CustomCredentialEntity { @Id + @Column(nullable = false) private String vcId; - @Lob - @Column(name = "credential") + @JdbcTypeCode(Types.LONGNVARCHAR) + @Convert(converter = CustomCredentialConverter.class) + @Column(name = "credential", nullable = false) private CustomCredential credential; } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java index 1f4f3b8..0e93e8b 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/DidDocumentEntity.java @@ -25,7 +25,6 @@ import jakarta.persistence.Convert; import jakarta.persistence.Entity; import jakarta.persistence.Id; -import jakarta.persistence.Lob; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -34,6 +33,9 @@ import lombok.Setter; import org.eclipse.tractusx.wallet.stub.did.DidDocument; import org.eclipse.tractusx.wallet.stub.utils.DidDocumentConverter; +import org.hibernate.annotations.JdbcTypeCode; + +import java.sql.Types; @Entity @Table(name="did_document") @@ -45,9 +47,10 @@ public class DidDocumentEntity { @Id + @Column(nullable = false) private String bpn; - @Lob + @JdbcTypeCode(Types.LONGNVARCHAR) @Convert(converter = DidDocumentConverter.class) @Column(name = "did_document", nullable = false) private DidDocument didDocument; diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java index cf497e0..8577e6f 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialAsJWTEntity.java @@ -37,9 +37,9 @@ public class HolderCredentialAsJWTEntity { @Id - @Column(name = "\"key\"") + @Column(name = "\"key\"", nullable = false) private String key; - @Column(name = "jwt", columnDefinition = "TEXT") + @Column(name = "jwt", columnDefinition = "TEXT", nullable = false) private String jwt; } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java index 44cd81b..dfced9b 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/HolderCredentialEntity.java @@ -22,9 +22,9 @@ package org.eclipse.tractusx.wallet.stub.dao.entity; import jakarta.persistence.Column; +import jakarta.persistence.Convert; import jakarta.persistence.Entity; import jakarta.persistence.Id; -import jakarta.persistence.Lob; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -32,6 +32,10 @@ import lombok.NoArgsConstructor; import lombok.Setter; import org.eclipse.tractusx.wallet.stub.utils.CustomCredential; +import org.eclipse.tractusx.wallet.stub.utils.CustomCredentialConverter; +import org.hibernate.annotations.JdbcTypeCode; + +import java.sql.Types; @Entity @Table(name="holder_credential") @@ -43,10 +47,11 @@ public class HolderCredentialEntity { @Id - @Column(name = "\"key\"") + @Column(name = "\"key\"", nullable = false) private String key; - @Lob - @Column(name = "credential") + @JdbcTypeCode(Types.LONGNVARCHAR) + @Convert(converter = CustomCredentialConverter.class) + @Column(name = "credential", nullable = false) private CustomCredential credential; } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java index 5926778..7a6557a 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/JWTCredentialEntity.java @@ -37,8 +37,9 @@ public class JWTCredentialEntity { @Id + @Column(nullable = false) private String vcId; - @Column(name = "jwt", columnDefinition = "TEXT") + @Column(name = "jwt", columnDefinition = "TEXT", nullable = false) private String jwt; } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java index 4f58bdb..5f47544 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/dao/entity/KeyPairEntity.java @@ -24,13 +24,15 @@ import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; -import jakarta.persistence.Lob; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.hibernate.annotations.JdbcTypeCode; + +import java.sql.Types; @Entity @Table(name="key_pair") @@ -42,13 +44,14 @@ public class KeyPairEntity { @Id + @Column(nullable = false) private String bpn; - @Lob + @JdbcTypeCode(Types.LONGNVARCHAR) @Column(name = "public_key", nullable = false) private String publicKey; - @Lob + @JdbcTypeCode(Types.LONGNVARCHAR) @Column(name = "private_key", nullable = false) private String privateKey; } diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/utils/CustomCredentialConverter.java b/src/main/java/org/eclipse/tractusx/wallet/stub/utils/CustomCredentialConverter.java new file mode 100644 index 0000000..4c5288d --- /dev/null +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/utils/CustomCredentialConverter.java @@ -0,0 +1,51 @@ +/* + * ******************************************************************************* + * Copyright (c) 2025 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.wallet.stub.utils; + +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.persistence.AttributeConverter; + +import java.io.IOException; + +public class CustomCredentialConverter implements AttributeConverter { + + private static final ObjectMapper objectMapper = new ObjectMapper(); + + + @Override + public String convertToDatabaseColumn(CustomCredential customCredential) { + try{ + return objectMapper.writeValueAsString(customCredential); + }catch (IOException e){ + throw new IllegalArgumentException("Error converting CustomCredential to JSON", e); + } + } + + @Override + public CustomCredential convertToEntityAttribute(String json) { + try{ + return objectMapper.readValue(json, CustomCredential.class); + }catch (IOException e){ + throw new IllegalArgumentException("Error converting JSON to CustomCredential", e); + } + } +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 779ff70..5317c9e 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,6 +1,6 @@ # # /******************************************************************************** -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -31,7 +31,7 @@ spring: profiles: active: ${STORAGE_TYPE:database} #Two options: in-memory(MemoryStorage) and database(DatabaseMemory) datasource: - url: ${SPRING_DATASOURCE_URL:jdbc:h2:mem:testdb} + url: ${SPRING_DATASOURCE_URL:jdbc:h2:mem:testdb;MODE=PostgreSQL} username: ${SPRING_DATASOURCE_USERNAME:sa} password: ${SPRING_DATASOURCE_PASSWORD:} driver-class-name: ${SPRING_DATASOURCE_DRIVER_CLASS_NAME:org.h2.Driver} From 6c78af041c2c9b81b616f93bff8b9ce1fb82004a Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Thu, 20 Feb 2025 10:23:34 +0100 Subject: [PATCH 6/9] feat: Modify the Verify workflow to include the two profiles --- .github/workflows/verify.yaml | 7 +++++-- build.gradle | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 3e0f0d7..b197769 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2024 Contributors to the Eclipse Foundation +# Copyright (c) 2025 Contributors to the Eclipse Foundation # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. @@ -122,8 +122,11 @@ jobs: unit-tests: runs-on: ubuntu-latest needs: [ Review-Allowed-Licenses, Dash-Verify-Licenses ] + strategy: + matrix: + profile: [testInMemory, testDatabase] steps: - uses: actions/checkout@v3.5.2 - uses: ./.github/actions/setup-java - name: Run Unit tests - run: ./gradlew test + run: ./gradlew ${{ matrix.profile }} diff --git a/build.gradle b/build.gradle index 89eabd0..08799d0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ /* * ******************************************************************************* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2025 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -138,6 +138,24 @@ jacocoTestCoverageVerification { } } +task testInMemory(type: Test){ + systemProperty 'spring.profiles.active', 'in-memory' + useJUnitPlatform() + finalizedBy jacocoTestReport + testLogging{ + events("passed", "skipped", "failed") + } +} + +task testDatabase(type: Test){ + systemProperty 'spring.profiles.active', 'database' + useJUnitPlatform() + finalizedBy jacocoTestReport + testLogging{ + events("passed", "skipped", "failed") + } +} + check.dependsOn jacocoTestCoverageVerification build { archivesBaseName = "wallet" From 924296c499f63eb348cb0f80683e0ad6a336d64b Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Thu, 20 Feb 2025 10:27:09 +0100 Subject: [PATCH 7/9] chore: Update DEPENDENCIES --- DEPENDENCIES | 92 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index d249b5b..fc0447b 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -4,18 +4,36 @@ maven/mavencentral/com.apicatalog/carbon-did/0.3.0, Apache-2.0, approved, clearl maven/mavencentral/com.apicatalog/copper-multibase/0.5.0, Apache-2.0, approved, #14501 maven/mavencentral/com.apicatalog/copper-multicodec/0.1.1, Apache-2.0, approved, #14500 maven/mavencentral/com.apicatalog/iron-verifiable-credentials/0.14.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.apicatalog/titanium-json-ld/1.0.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.apicatalog/titanium-json-ld/1.4.0, Apache-2.0, approved, #15200 +maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.15.3, Apache-2.0, approved, #15260 +maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.16.0, Apache-2.0, approved, #11606 +maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.16.2, Apache-2.0, approved, #11606 maven/mavencentral/com.fasterxml.jackson.core/jackson-annotations/2.17.2, Apache-2.0, approved, #13672 +maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.15.3, , approved, #15194 maven/mavencentral/com.fasterxml.jackson.core/jackson-core/2.17.2, Apache-2.0 AND MIT, approved, #13665 +maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.11.0, Apache-2.0, approved, CQ23093 +maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.15.3, Apache-2.0, approved, #15199 +maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.16.0, Apache-2.0, approved, #11605 +maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.16.2, Apache-2.0, approved, #11605 maven/mavencentral/com.fasterxml.jackson.core/jackson-databind/2.17.2, Apache-2.0, approved, #13671 +maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.16.0, Apache-2.0, approved, #11855 +maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.16.2, Apache-2.0, approved, #11855 maven/mavencentral/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.17.2, Apache-2.0, approved, #13669 maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.17.2, Apache-2.0, approved, #15117 +maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.16.0, Apache-2.0, approved, #11853 +maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.16.2, Apache-2.0, approved, #11853 maven/mavencentral/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.17.2, Apache-2.0, approved, #14160 +maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-base/2.15.3, Apache-2.0, approved, #9235 maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-base/2.17.2, Apache-2.0, approved, #14194 +maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.15.3, Apache-2.0, approved, #9236 +maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.16.2, Apache-2.0, approved, #11858 maven/mavencentral/com.fasterxml.jackson.jakarta.rs/jackson-jakarta-rs-json-provider/2.17.2, Apache-2.0, approved, #14195 +maven/mavencentral/com.fasterxml.jackson.module/jackson-module-jakarta-xmlbind-annotations/2.15.3, Apache-2.0, approved, #9241 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-jakarta-xmlbind-annotations/2.17.2, Apache-2.0, approved, #13668 maven/mavencentral/com.fasterxml.jackson.module/jackson-module-parameter-names/2.17.2, Apache-2.0, approved, #15122 -maven/mavencentral/com.fasterxml/classmate/1.7.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/com.fasterxml.jackson/jackson-bom/2.17.2, Apache-2.0, approved, #14162 +maven/mavencentral/com.fasterxml/classmate/1.5.1, Apache-2.0, approved, clearlydefined maven/mavencentral/com.github.curious-odd-man/rgxgen/2.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.github.java-json-tools/json-patch/1.13, Apache-2.0 OR LGPL-3.0-or-later, approved, CQ23929 maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, Apache-2.0 and CC-BY-2.5, approved, #15220 @@ -33,7 +51,7 @@ maven/mavencentral/com.sun.xml.bind.external/relaxng-datatype/4.0.3, BSD-3-Claus maven/mavencentral/com.sun.xml.bind.external/rngom/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310 maven/mavencentral/com.zaxxer/HikariCP/5.1.0, Apache-2.0, approved, clearlydefined -maven/mavencentral/commons-codec/commons-codec/1.16.1, Apache-2.0 AND (Apache-2.0 AND BSD-3-Clause), approved, #9157 +maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641 maven/mavencentral/commons-fileupload/commons-fileupload/1.5, Apache-2.0, approved, #7109 maven/mavencentral/commons-io/commons-io/2.11.0, Apache-2.0, approved, CQ23745 maven/mavencentral/commons-logging/commons-logging/1.2, Apache-2.0, approved, CQ10162 @@ -46,8 +64,9 @@ maven/mavencentral/io.github.openfeign/feign-slf4j/13.3, Apache-2.0, approved, c maven/mavencentral/io.micrometer/micrometer-commons/1.13.2, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #14826 maven/mavencentral/io.micrometer/micrometer-core/1.13.2, Apache-2.0 AND (Apache-2.0 AND MIT), approved, #14827 maven/mavencentral/io.micrometer/micrometer-jakarta9/1.13.2, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.micrometer/micrometer-observation/1.12.8, Apache-2.0, approved, #11680 maven/mavencentral/io.micrometer/micrometer-observation/1.13.2, Apache-2.0, approved, #14829 -maven/mavencentral/io.opentelemetry/opentelemetry-api/1.37.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/io.opentelemetry/opentelemetry-api/1.32.0, Apache-2.0, approved, #11682 maven/mavencentral/io.opentelemetry/opentelemetry-context/1.37.0, Apache-2.0, approved, clearlydefined maven/mavencentral/io.setl/rdf-urdna/1.1, Apache-2.0, approved, clearlydefined maven/mavencentral/io.smallrye/jandex/3.1.2, Apache-2.0, approved, clearlydefined @@ -56,28 +75,40 @@ maven/mavencentral/io.swagger.core.v3/swagger-annotations-jakarta/2.2.22, Apache maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.20, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-core-jakarta/2.2.22, Apache-2.0, approved, #5929 maven/mavencentral/io.swagger.core.v3/swagger-integration-jakarta/2.2.22, Apache-2.0, approved, #11475 +maven/mavencentral/io.swagger.core.v3/swagger-jaxrs2-jakarta/2.2.21, Apache-2.0, approved, #11477 maven/mavencentral/io.swagger.core.v3/swagger-jaxrs2-jakarta/2.2.22, Apache-2.0, approved, #11477 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.20, Apache-2.0, approved, #5919 maven/mavencentral/io.swagger.core.v3/swagger-models-jakarta/2.2.22, Apache-2.0, approved, #5919 +maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.0, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf +maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.2, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf maven/mavencentral/jakarta.activation/jakarta.activation-api/2.1.3, EPL-2.0 OR BSD-3-Clause OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jaf +maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.annotation/jakarta.annotation-api/2.1.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.ca maven/mavencentral/jakarta.inject/jakarta.inject-api/2.0.1, Apache-2.0, approved, ee4j.cdi maven/mavencentral/jakarta.json/jakarta.json-api/2.1.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp -maven/mavencentral/jakarta.mail/jakarta.mail-api/2.1.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.mail +maven/mavencentral/jakarta.mail/jakarta.mail-api/2.1.2, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.mail maven/mavencentral/jakarta.persistence/jakarta.persistence-api/3.1.0, EPL-2.0 OR BSD-3-Clause, approved, ee4j.jpa maven/mavencentral/jakarta.transaction/jakarta.transaction-api/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jta maven/mavencentral/jakarta.validation/jakarta.validation-api/3.0.2, Apache-2.0, approved, ee4j.validation maven/mavencentral/jakarta.ws.rs/jakarta.ws.rs-api/3.1.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.rest +maven/mavencentral/jakarta.ws.rs/jakarta.ws.rs-api/4.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.rest +maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/3.0.1, BSD-3-Clause, approved, ee4j.jaxb +maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.0, BSD-3-Clause, approved, ee4j.jaxb maven/mavencentral/jakarta.xml.bind/jakarta.xml.bind-api/4.0.2, BSD-3-Clause, approved, ee4j.jaxb -maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.18, Apache-2.0, approved, #7164 -maven/mavencentral/net.bytebuddy/byte-buddy/1.14.18, Apache-2.0 AND BSD-3-Clause, approved, #7163 +maven/mavencentral/net.bytebuddy/byte-buddy-agent/1.14.12, Apache-2.0, approved, #7164 +maven/mavencentral/net.bytebuddy/byte-buddy/1.14.11, Apache-2.0 AND BSD-3-Clause, approved, #7163 +maven/mavencentral/net.bytebuddy/byte-buddy/1.14.12, Apache-2.0 AND BSD-3-Clause, approved, #7163 +maven/mavencentral/net.bytebuddy/byte-buddy/1.14.15, Apache-2.0 AND BSD-3-Clause, approved, #7163 maven/mavencentral/net.minidev/accessors-smart/2.5.1, Apache-2.0, approved, #19432 +maven/mavencentral/net.minidev/json-smart/2.5.0, Apache-2.0, approved, #19431 maven/mavencentral/net.minidev/json-smart/2.5.1, Apache-2.0, approved, #19431 maven/mavencentral/org.antlr/antlr4-runtime/4.13.0, BSD-3-Clause, approved, #10767 +maven/mavencentral/org.apache.commons/commons-lang3/3.14.0, Apache-2.0, approved, #11677 maven/mavencentral/org.apache.commons/commons-lang3/3.15.0, Apache-2.0, approved, clearlydefined maven/mavencentral/org.apache.commons/commons-text/1.12.0, Apache-2.0, approved, #14414 maven/mavencentral/org.apache.httpcomponents.client5/httpclient5/5.3.1, Apache-2.0, approved, #12911 -maven/mavencentral/org.apache.httpcomponents.core5/httpcore5-h2/5.2.5, Apache-2.0, approved, #10658 +maven/mavencentral/org.apache.httpcomponents.core5/httpcore5-h2/5.2.4, Apache-2.0, approved, #10658 +maven/mavencentral/org.apache.httpcomponents.core5/httpcore5/5.2.4, Apache-2.0, approved, #9652 maven/mavencentral/org.apache.httpcomponents.core5/httpcore5/5.2.5, Apache-2.0, approved, #9652 maven/mavencentral/org.apache.httpcomponents/httpclient/4.5.14, Apache-2.0, approved, #15248 maven/mavencentral/org.apache.httpcomponents/httpcore/4.4.16, Apache-2.0, approved, CQ23528 @@ -96,8 +127,9 @@ maven/mavencentral/org.awaitility/awaitility/4.2.1, Apache-2.0, approved, #14178 maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.78, MIT AND CC0-1.0, approved, #14433 maven/mavencentral/org.bouncycastle/bcprov-jdk18on/1.78.1, MIT AND CC0-1.0, approved, #14433 maven/mavencentral/org.checkerframework/checker-qual/3.42.0, MIT, approved, clearlydefined +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.angus/angus-activation/2.0.2, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus -maven/mavencentral/org.eclipse.angus/angus-mail/2.0.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus +maven/mavencentral/org.eclipse.angus/angus-mail/1.0.0, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.angus maven/mavencentral/org.eclipse.edc/api-configuration/0.8.1, Apache-2.0, approved, technology.edc maven/mavencentral/org.eclipse.edc/boot-spi/0.8.1, Apache-2.0, approved, technology.edc maven/mavencentral/org.eclipse.edc/core-spi/0.8.1, Apache-2.0, approved, technology.edc @@ -128,14 +160,18 @@ maven/mavencentral/org.eclipse.edc/verifiable-credentials-spi/0.8.1, Apache-2.0, maven/mavencentral/org.eclipse.edc/web-spi/0.8.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.parsson/parsson/1.1.6, EPL-2.0, approved, ee4j.parsson -maven/mavencentral/org.glassfish.jaxb/codemodel/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/codemodel/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl maven/mavencentral/org.glassfish.jaxb/jaxb-core/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-jxc/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/jaxb-xjc/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-jxc/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.2, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-runtime/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/jaxb-xjc/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/txw2/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl maven/mavencentral/org.glassfish.jaxb/txw2/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl -maven/mavencentral/org.glassfish.jaxb/xsom/4.0.5, BSD-3-Clause, approved, ee4j.jaxb-impl +maven/mavencentral/org.glassfish.jaxb/xsom/4.0.3, BSD-3-Clause, approved, ee4j.jaxb-impl maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp +maven/mavencentral/org.hamcrest/hamcrest/2.1, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, #17677 maven/mavencentral/org.hdrhistogram/HdrHistogram/2.2.2, BSD-2-Clause AND CC0-1.0 AND CC0-1.0, approved, #14828 maven/mavencentral/org.hibernate.common/hibernate-commons-annotations/6.0.6.Final, LGPL-2.1-only, approved, #6962 @@ -145,6 +181,7 @@ maven/mavencentral/org.jacoco/org.jacoco.ant/0.8.11, EPL-2.0, approved, #1068 maven/mavencentral/org.jacoco/org.jacoco.core/0.8.11, EPL-2.0, approved, CQ23283 maven/mavencentral/org.jacoco/org.jacoco.report/0.8.11, EPL-2.0 AND Apache-2.0, approved, CQ23284 maven/mavencentral/org.javassist/javassist/3.30.2-GA, Apache-2.0 AND LGPL-2.1-or-later AND MPL-1.1, approved, #12108 +maven/mavencentral/org.jboss.logging/jboss-logging/3.5.0.Final, Apache-2.0, approved, #9471 maven/mavencentral/org.jboss.logging/jboss-logging/3.5.3.Final, Apache-2.0, approved, #9471 maven/mavencentral/org.jboss.resteasy/resteasy-client-api/6.2.7.Final, Apache-2.0, approved, #10223 maven/mavencentral/org.jboss.resteasy/resteasy-client/6.2.7.Final, Apache-2.0, approved, clearlydefined @@ -155,6 +192,7 @@ maven/mavencentral/org.jboss.resteasy/resteasy-jaxb-provider/6.2.7.Final, Apache maven/mavencentral/org.jboss.resteasy/resteasy-multipart-provider/6.2.7.Final, Apache-2.0, approved, clearlydefined maven/mavencentral/org.jboss/jandex/2.4.4.Final, Apache-2.0, approved, clearlydefined maven/mavencentral/org.jetbrains/annotations/24.1.0, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.2, EPL-2.0, approved, #9714 maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.3, EPL-2.0, approved, #9714 maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.10.3, EPL-2.0, approved, #9711 maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.10.3, EPL-2.0, approved, #15250 @@ -162,6 +200,7 @@ maven/mavencentral/org.junit.jupiter/junit-jupiter/5.10.3, EPL-2.0, approved, #1 maven/mavencentral/org.junit.platform/junit-platform-commons/1.10.3, EPL-2.0, approved, #9715 maven/mavencentral/org.junit.platform/junit-platform-engine/1.10.3, EPL-2.0, approved, #9709 maven/mavencentral/org.junit.platform/junit-platform-launcher/1.10.3, EPL-2.0, approved, #15216 +maven/mavencentral/org.junit/junit-bom/5.10.3, EPL-2.0, approved, #9844 maven/mavencentral/org.keycloak/keycloak-admin-client/25.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.keycloak/keycloak-common/25.0.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.keycloak/keycloak-core/25.0.2, Apache-2.0, approved, clearlydefined @@ -173,28 +212,29 @@ maven/mavencentral/org.opentest4j/opentest4j/1.3.0, Apache-2.0, approved, #9713 maven/mavencentral/org.ow2.asm/asm-commons/9.6, BSD-3-Clause, approved, #10775 maven/mavencentral/org.ow2.asm/asm-tree/9.6, BSD-3-Clause, approved, #10773 maven/mavencentral/org.ow2.asm/asm/9.6, BSD-3-Clause, approved, #10776 -maven/mavencentral/org.postgresql/postgresql/42.7.3, BSD-2-Clause AND Apache-2.0, approved, #11681 -maven/mavencentral/org.projectlombok/lombok/1.18.34, MIT, approved, #15192 maven/mavencentral/org.reactivestreams/reactive-streams/1.0.4, CC0-1.0, approved, CQ16332 maven/mavencentral/org.skyscreamer/jsonassert/1.5.3, Apache-2.0, approved, clearlydefined maven/mavencentral/org.slf4j/jul-to-slf4j/2.0.13, MIT, approved, #7698 +maven/mavencentral/org.slf4j/slf4j-api/1.7.26, MIT, approved, CQ13368 +maven/mavencentral/org.slf4j/slf4j-api/1.7.36, MIT, approved, CQ13368 +maven/mavencentral/org.slf4j/slf4j-api/2.0.11, MIT, approved, #5915 maven/mavencentral/org.slf4j/slf4j-api/2.0.13, MIT, approved, #5915 +maven/mavencentral/org.slf4j/slf4j-api/2.0.2, MIT, approved, #5915 +maven/mavencentral/org.slf4j/slf4j-api/2.0.9, MIT, approved, #5915 maven/mavencentral/org.springdoc/springdoc-openapi-starter-common/2.4.0, Apache-2.0, approved, #13755 maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-api/2.4.0, Apache-2.0, approved, #13748 maven/mavencentral/org.springdoc/springdoc-openapi-starter-webmvc-ui/2.4.0, Apache-2.0, approved, #13754 maven/mavencentral/org.springframework.boot/spring-boot-actuator-autoconfigure/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-actuator/3.3.2, Apache-2.0, approved, #16976 +maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.3, Apache-2.0, approved, #11751 +maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.2.7, Apache-2.0, approved, #11751 maven/mavencentral/org.springframework.boot/spring-boot-autoconfigure/3.3.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.boot/spring-boot-devtools/3.3.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.boot/spring-boot-starter-actuator/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-aop/3.3.2, Apache-2.0, approved, #16896 -maven/mavencentral/org.springframework.boot/spring-boot-starter-data-jpa/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-jdbc/3.3.2, Apache-2.0, approved, #16885 maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.3.2, Apache-2.0, approved, #16886 -maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.3.2, Apache-2.0, approved, #16975 maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.3.2, Apache-2.0, approved, clearlydefined -maven/mavencentral/org.springframework.boot/spring-boot-starter-web/3.3.2, Apache-2.0, approved, #16893 +maven/mavencentral/org.springframework.boot/spring-boot-starter/3.2.7, Apache-2.0, approved, #11935 maven/mavencentral/org.springframework.boot/spring-boot-starter/3.3.2, Apache-2.0, approved, #16895 maven/mavencentral/org.springframework.boot/spring-boot-test-autoconfigure/3.3.2, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.boot/spring-boot-test/3.3.2, Apache-2.0, approved, clearlydefined @@ -206,21 +246,29 @@ maven/mavencentral/org.springframework.cloud/spring-cloud-starter-openfeign/4.1. maven/mavencentral/org.springframework.cloud/spring-cloud-starter/4.1.4, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework.data/spring-data-commons/3.3.2, Apache-2.0, approved, #15116 maven/mavencentral/org.springframework.data/spring-data-jpa/3.3.2, Apache-2.0, approved, #15120 -maven/mavencentral/org.springframework.security/spring-security-crypto/6.3.1, Apache-2.0, approved, clearlydefined +maven/mavencentral/org.springframework.security/spring-security-crypto/6.2.5, Apache-2.0 AND ISC, approved, #11908 maven/mavencentral/org.springframework.security/spring-security-rsa/1.1.3, Apache-2.0, approved, clearlydefined maven/mavencentral/org.springframework/spring-aop/6.1.11, Apache-2.0, approved, #15221 +maven/mavencentral/org.springframework/spring-aop/6.1.9, Apache-2.0, approved, #15221 maven/mavencentral/org.springframework/spring-aspects/6.1.11, Apache-2.0, approved, #15193 maven/mavencentral/org.springframework/spring-beans/6.1.11, Apache-2.0, approved, #15213 +maven/mavencentral/org.springframework/spring-beans/6.1.9, Apache-2.0, approved, #15213 maven/mavencentral/org.springframework/spring-context/6.1.11, Apache-2.0, approved, #15261 +maven/mavencentral/org.springframework/spring-context/6.1.9, Apache-2.0, approved, #15261 maven/mavencentral/org.springframework/spring-core/6.1.11, Apache-2.0 AND BSD-3-Clause, approved, #15206 +maven/mavencentral/org.springframework/spring-core/6.1.9, Apache-2.0 AND BSD-3-Clause, approved, #15206 maven/mavencentral/org.springframework/spring-expression/6.1.11, Apache-2.0, approved, #15264 maven/mavencentral/org.springframework/spring-jcl/6.1.11, Apache-2.0, approved, #15266 maven/mavencentral/org.springframework/spring-jdbc/6.1.11, Apache-2.0, approved, #15191 -maven/mavencentral/org.springframework/spring-orm/6.1.11, Apache-2.0, approved, #15278 +maven/mavencentral/org.springframework/spring-orm/6.1.9, Apache-2.0, approved, #15278 maven/mavencentral/org.springframework/spring-test/6.1.11, Apache-2.0, approved, #15265 maven/mavencentral/org.springframework/spring-tx/6.1.11, Apache-2.0, approved, #15229 +maven/mavencentral/org.springframework/spring-tx/6.1.9, Apache-2.0, approved, #15229 +maven/mavencentral/org.springframework/spring-web/5.1.5.RELEASE, Apache-2.0 AND LicenseRef-Public-Domain, approved, CQ18367 +maven/mavencentral/org.springframework/spring-web/6.1.10, Apache-2.0, approved, #15188 maven/mavencentral/org.springframework/spring-web/6.1.11, Apache-2.0, approved, #15188 maven/mavencentral/org.springframework/spring-webmvc/6.1.11, Apache-2.0, approved, #15182 +maven/mavencentral/org.springframework/spring-webmvc/6.1.4, Apache-2.0, approved, #15182 maven/mavencentral/org.webjars/swagger-ui/5.11.8, Apache-2.0, approved, #13756 maven/mavencentral/org.xmlunit/xmlunit-core/2.9.1, Apache-2.0, approved, #6272 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 From 6afb5d68ec622f1f8978d0086029db2438fa2b1e Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Thu, 20 Feb 2025 11:47:54 +0100 Subject: [PATCH 8/9] feat: Be able to use persist data --- .../templates/database-configmap.yaml | 2 + charts/ssi-dim-wallet-stub/values.yaml | 1 + .../stub/config/InitialSetupConfig.java | 49 ++++++++++--------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/charts/ssi-dim-wallet-stub/templates/database-configmap.yaml b/charts/ssi-dim-wallet-stub/templates/database-configmap.yaml index f1e70b6..f2347d0 100644 --- a/charts/ssi-dim-wallet-stub/templates/database-configmap.yaml +++ b/charts/ssi-dim-wallet-stub/templates/database-configmap.yaml @@ -18,6 +18,7 @@ ############################################################### --- +{{- if .Values.wallet.postgresql.enabled }} apiVersion: v1 kind: ConfigMap metadata: @@ -28,3 +29,4 @@ data: POSTGRES_DB: {{quote .Values.postgresql.auth.database }} POSTGRES_USER: {{quote .Values.postgresql.auth.username }} POSTGRES_PASSWORD: {{quote .Values.postgresql.auth.password }} +{{- end }} diff --git a/charts/ssi-dim-wallet-stub/values.yaml b/charts/ssi-dim-wallet-stub/values.yaml index 09b8eb0..799a409 100644 --- a/charts/ssi-dim-wallet-stub/values.yaml +++ b/charts/ssi-dim-wallet-stub/values.yaml @@ -173,6 +173,7 @@ postgresql: size: 10Gi storageClass: standard initdb: + enabled: true scripts: init.sql: |- CREATE TABLE IF NOT EXISTS custom_credential( diff --git a/src/main/java/org/eclipse/tractusx/wallet/stub/config/InitialSetupConfig.java b/src/main/java/org/eclipse/tractusx/wallet/stub/config/InitialSetupConfig.java index 7f93a5c..34f81a0 100644 --- a/src/main/java/org/eclipse/tractusx/wallet/stub/config/InitialSetupConfig.java +++ b/src/main/java/org/eclipse/tractusx/wallet/stub/config/InitialSetupConfig.java @@ -1,6 +1,6 @@ /* * ******************************************************************************* - * Copyright (c) 2024 Contributors to the Eclipse Foundation + * Copyright (c) 2025 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -27,10 +27,10 @@ import org.eclipse.tractusx.wallet.stub.portal.PortalStubService; import org.eclipse.tractusx.wallet.stub.portal.dto.SetupDimRequest; import org.eclipse.tractusx.wallet.stub.statuslist.StatusListCredentialService; +import org.eclipse.tractusx.wallet.stub.storage.Storage; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; -import java.util.ArrayList; /** * The type Initial setup config class. It will create an Operator(base wallet) once the application is ready @@ -40,6 +40,7 @@ @Slf4j public class InitialSetupConfig { + private final Storage storage; private final PortalStubService portalStubService; @@ -57,29 +58,33 @@ public class InitialSetupConfig { @SneakyThrows @EventListener(ApplicationReadyEvent.class) public void setupBaseWallet() { - SetupDimRequest request = new SetupDimRequest(); - request.setBpn(walletStubSettings.baseWalletBPN()); - request.setCompanyName("Eclipse Tractus-x Operating Company"); - request.setDidDocumentLocation(walletStubSettings.didHost()); + if(storage.getDidDocument(walletStubSettings.baseWalletBPN()).isEmpty()){ + SetupDimRequest request = new SetupDimRequest(); + request.setBpn(walletStubSettings.baseWalletBPN()); + request.setCompanyName("Eclipse Tractus-x Operating Company"); + request.setDidDocumentLocation(walletStubSettings.didHost()); - //create did a document and lry pair - portalStubService.setupDim(request); + //create did a document and lry pair + portalStubService.setupDim(request); - //create status list VC - statusListCredentialService.getStatusListCredential(walletStubSettings.baseWalletBPN(), walletStubSettings.statusListVcId()); + //create status list VC + statusListCredentialService.getStatusListCredential(walletStubSettings.baseWalletBPN(), walletStubSettings.statusListVcId()); - //create wallets for the seeded BPNs specified in the configuration - int cont = 1; - for (String bpn: walletStubSettings.seedWalletsBPN()){ - SetupDimRequest seedRequest = new SetupDimRequest(); - seedRequest.setBpn(bpn); - seedRequest.setCompanyName("Seed Wallet "+cont); - seedRequest.setDidDocumentLocation(walletStubSettings.didHost()); - portalStubService.setupDim(seedRequest); - statusListCredentialService.getStatusListCredential(bpn, walletStubSettings.statusListVcId()); - cont++; - } + //create wallets for the seeded BPNs specified in the configuration + int cont = 1; + for (String bpn: walletStubSettings.seedWalletsBPN()){ + SetupDimRequest seedRequest = new SetupDimRequest(); + seedRequest.setBpn(bpn); + seedRequest.setCompanyName("Seed Wallet "+cont); + seedRequest.setDidDocumentLocation(walletStubSettings.didHost()); + portalStubService.setupDim(seedRequest); + statusListCredentialService.getStatusListCredential(bpn, walletStubSettings.statusListVcId()); + cont++; + } - log.debug("Base wallet with bpn is {} created and status list VC is also created", walletStubSettings.baseWalletBPN()); + log.debug("Base wallet with bpn is {} created and status list VC is also created", walletStubSettings.baseWalletBPN()); + }else { + log.debug("Wallet is using persistent data."); + } } } From b9c9af0eaf69a2e029915295d1580fea98ccb996 Mon Sep 17 00:00:00 2001 From: Carlos Diez Date: Thu, 20 Feb 2025 12:51:45 +0100 Subject: [PATCH 9/9] chore: Document the new changes --- AUTHORS.md | 1 + README.md | 45 +++++---- charts/ssi-dim-wallet-stub/README.md | 127 ++++++++++++++----------- charts/ssi-dim-wallet-stub/values.yaml | 3 + docs/architecture/main.md | 12 +-- 5 files changed, 108 insertions(+), 80 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 607950d..6ed5738 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -7,3 +7,4 @@ The following people have contributed to this repository: * Ronak Thacker, Cofinity-X GmbH, https://github.com/thackerronak * Leandro Willians Cavalcante Farias, Cofinity-X GmbH, https://github.com/leandro-cavalcante * Nitin Vavdiya, Cofinity-X GmbH, https://github.com/nitin-vavdiya +* Carlos Diez Rodriguez, LKS Next, https://github.com/CDiezRodriguez diff --git a/README.md b/README.md index 85cbfa8..f91b4d6 100644 --- a/README.md +++ b/README.md @@ -22,22 +22,27 @@ The DIM Wallet is part of the Self-Sovereign Identity (SSI) Flow of Eclipse Trac 1. Update env variables in [application.yaml](src%2Fmain%2Fresources%2Fapplication.yaml) -| Name | Description | Default value | -|------------------------|----------------------------------------------------------------------------------|--------------------------------------| -| APPLICATION_PORT | Application port | 8080 | -| STUB_ENV | Environment(LZ) in with application is running. | local | -| BASE_WALLET_BPN | Issuer BPN number | BPNL000000000000 | -| SEED_WALLETS_BPN | List of BPNs for which wallets will be seeded on application startup | BPNL00000003AZQP,BPNL00000003AYRE | -| STUB_HOST | Wallet stub application host | | -| STATUS_LIST_VC_ID | VC id of status list credential of base wallet | 8a6c7486-1e1f-4555-bdd2-1a178182651e | -| TOKEN_EXPIRY_TIME | JWT(STS, VC and VP) expiry time in minutes | 5 | -| PORTAL_WAIT_TIME | Wait time before we push did document to portal after wallet creation in seconds | 60 | -| PORTAL_HOST | Host of port backend application | | -| PORTAL_CLIENT_ID | Keycloak client_id to access portal API | | -| PORTAL_CLIENT_SECRET | keycloak client_secret to access portal API | | -| PORTAL_REALM | keycloak realm | | -| PORTAL_AUTH_SERVER_URL | Authentication server(keycloak) | | -| APP_LOG_LEVEL | Log level of application | DEBUG | +| Name | Description | Default value | +|--------------------------------------|----------------------------------------------------------------------------------|--------------------------------------| +| APPLICATION_PORT | Application port | 8080 | +| STUB_ENV | Environment(LZ) in with application is running. | local | +| BASE_WALLET_BPN | Issuer BPN number | BPNL000000000000 | +| SEED_WALLETS_BPN | List of BPNs for which wallets will be seeded on application startup | BPNL00000003AZQP,BPNL00000003AYRE | +| STUB_HOST | Wallet stub application host | | +| STATUS_LIST_VC_ID | VC id of status list credential of base wallet | 8a6c7486-1e1f-4555-bdd2-1a178182651e | +| TOKEN_EXPIRY_TIME | JWT(STS, VC and VP) expiry time in minutes | 5 | +| PORTAL_WAIT_TIME | Wait time before we push did document to portal after wallet creation in seconds | 60 | +| PORTAL_HOST | Host of port backend application | | +| PORTAL_CLIENT_ID | Keycloak client_id to access portal API | | +| PORTAL_CLIENT_SECRET | keycloak client_secret to access portal API | | +| PORTAL_REALM | keycloak realm | | +| PORTAL_AUTH_SERVER_URL | Authentication server(keycloak) | | +| APP_LOG_LEVEL | Log level of application | DEBUG | +| STORAGE_TYPE | The available storage options are: in-memory or database | database | +| SPRING_DATASOURCE_URL | The URL to connect to the database | jdbc:h2:mem:testdb;MODE=PostgreSQL | +| SPRING_DATASOURCE_USERNAME | The username to access the database | sa | +| SPRING_DATASOURCE_PASSWORD | The password to access the database | | +| SPRING_DATASOURCE_DRIVER_CLASS_NAME | The driver used for the database | org.h2.Driver | 2. Run application using gradle @@ -56,8 +61,10 @@ Detailed documentation can be found [here](docs%2FREADME.md) ### Important notes and limitation of application -1. Simple Java ``Map`` is used to store keypair, VC and VP of wallet to avoid any further complexity. Please - refer [MemoryStorage.java](src%2Fmain%2Fjava%2Forg%2Feclipse%2Ftractusx%2Fwallet%2Fstub%2Fstorage%2FMemoryStorage.java) +1. There are two possible options, each defined in separate Spring profiles: in-memory and database. + 1. Simple Java ``Map`` is used to store keypair, VC and VP of wallet to avoid any further complexity. Please + refer [MemoryStorage.java](src%2Fmain%2Fjava%2Forg%2Feclipse%2Ftractusx%2Fwallet%2Fstub%2Fstorage%2FMemoryStorage.java) + 2. Stored in the database: [DatabaseStorage.java](src%2Fmain%2Fjava%2Forg%2Feclipse%2Ftractusx%2Fwallet%2Fstub%2Fstorage%2FDatabaseStorage.java) 2. This application will create same key for given BPN on given environment. Please refer [DeterministicECKeyPairGenerator.java](src%2Fmain%2Fjava%2Forg%2Feclipse%2Ftractusx%2Fwallet%2Fstub%2Futils%2FDeterministicECKeyPairGenerator.java) 3. If a wallet is not created at any point of request, application will create a new wallet at runtime @@ -68,7 +75,7 @@ Detailed documentation can be found [here](docs%2FREADME.md) 8. Negative scenarios are not covered 9. ``jti`` claim is not validated 10. No actual revocation of verifiable credentials -11. All stored credentials will be lost on restart of the application +11. All stored credentials will be lost upon application restart unless persistence and the database are enabled. 12. JWTs are printed with debug log level for debugging purposes diff --git a/charts/ssi-dim-wallet-stub/README.md b/charts/ssi-dim-wallet-stub/README.md index 4bd8fd9..89652a9 100644 --- a/charts/ssi-dim-wallet-stub/README.md +++ b/charts/ssi-dim-wallet-stub/README.md @@ -6,9 +6,10 @@ ### Requirements -| Repository | Name | Version | -|------------|------|---------| -| https://charts.bitnami.com/bitnami | keycloak | 22.1.0 | +| Repository | Name | Version | +|------------|-------------|---------| +| https://charts.bitnami.com/bitnami | keycloak | 22.1.0 | +| https://charts.bitnami.com/bitnami | postgresql | 16.4.8 | ### Prerequisites - Kubernetes 1.19+ @@ -36,55 +37,71 @@ helm install wallet-stub -n wallet charts/ssi-dim-wallet-stub ## Configuration Values -| Parameter | Description | Default Value | -|---------------------------------------------|---------------------------------------------------------------------------------------------------------------|------------------------------------------| -| `wallet.replicaCount` | The amount of replicas to run | `1` | -| `wallet.host` | Hostname for the wallet stub application | `localhost` | -| `wallet.nameSpace` | The namespace | `"wallet"` | -| `wallet.appName` | The application name | `"ssi-dim-wallet-stub"` | -| `wallet.configName` | The configmap name | `"ssi-dim-wallet-config"` | -| `wallet.serviceName` | The service name | `"ssi-dim-wallet-service"` | -| `wallet.secretName` | The secret name | `"ssi-dim-wallet-secret"` | -| `wallet.ingressName` | The ingress name | `"ssi-dim-wallet-ingress"` | -| `wallet.image.repository` | Image repository | `tractusx/managed-identity-wallet` | -| `wallet.image.pullPolicy` | Pull policy for the image | `IfNotPresent` | -| `wallet.image.tag` | Image tag (leave empty to use "appVersion" value from chart definition) | `""` | -| `wallet.resources.requests.cpu` | CPU resource requests | `250m` | -| `wallet.resources.requests.memory` | Memory resource requests | `512Mi` | -| `wallet.resources.limits.cpu` | CPU resource limits | `500m` | -| `wallet.resources.limits.memory` | Memory resource limits | `1Gi` | -| `wallet.livenessProbe.enabled` | Enables/Disables the liveness probe | `true` | -| `wallet.livenessProbe.failureThreshold` | Number of failures before restarting the container | `3` | -| `wallet.livenessProbe.initialDelaySeconds` | Initial delay before starting the liveness probe | `20` | -| `wallet.livenessProbe.timeoutSeconds` | Timeout for the liveness probe | `15` | -| `wallet.livenessProbe.periodSeconds` | How often to perform the liveness probe | `5` | -| `wallet.readinessProbe.enabled` | Enables/Disables the readiness probe | `true` | -| `wallet.readinessProbe.failureThreshold` | Number of failures before marking the Pod as Unready | `3` | -| `wallet.readinessProbe.initialDelaySeconds` | Initial delay before starting the readiness probe | `30` | -| `wallet.readinessProbe.periodSeconds` | How often to perform the readiness probe | `5` | -| `wallet.readinessProbe.successThreshold` | Minimum consecutive successes for the readiness probe to be considered successful | `1` | -| `wallet.readinessProbe.timeoutSeconds` | Timeout for the readiness probe | `5` | -| `wallet.ingress.enabled` | Enable ingress configuration | `false` | -| `wallet.ingress.tls` | Enable TLS for ingress | `false` | -| `wallet.ingress.urlPrefix` | URL prefix for the ingress | `/` | -| `wallet.ingress.className` | Ingress class name | `nginx` | -| `wallet.ingress.annotations` | Annotations for the ingress | `{}` | -| `wallet.swagger.ui.status` | Enable Swagger API documentation UI | `true` | -| `wallet.swagger.apiDoc.status` | Enable OpenAPI documentation | `true` | -| `wallet.logLevel` | Application log level | `"debug"` | -| `wallet.environment` | Name of the landing zone (e.g., dev, int, prod) | `"default"` | -| `wallet.baseWalletBpn` | Operator Business Partner Number (BPN) | `"BPNL000000000000"` | -| `wallet.seeding.bpnList` | List of BPNs for which wallets will be seeded on application startup | `""` | -| `wallet.didHost` | DID document host, used as part of the DID string (e.g., did:web:) | `"localhost"` | -| `wallet.stubUrl` | Wallet stub server URL, used as part of the presentation query API in the DID document | `"http://localhost"` | -| `wallet.statusListVcId` | Default status list Verifiable Credential (VC) ID | `"8a6c7486-1e1f-4555-bdd2-1a178182651e"` | -| `wallet.tokenExpiryTime` | Token expiry time in seconds | `"5"` | -| `wallet.portal.waitTime` | Wait time before pushing data to portal backend after wallet creation | `60` | -| `wallet.portal.host` | Portal backend application host | `"http://localhost"` | -| `wallet.portal.clientId` | Keycloak client ID for accessing portal backend APIs | `"client_id"` | -| `wallet.portal.clientSecret` | Keycloak client secret for accessing portal backend APIs | `"client_secret"` | -| `wallet.keycloak.realm` | Keycloak realm name | `"CX-Central"` | -| `wallet.keycloak.authServerUrl` | Keycloak host URL | `"http://localhost:28080/auth"` | -| `wallet.service.type` | Kubernetes service type | `ClusterIP` | -| `wallet.service.port` | Kubernetes service port | `8080` | -| `keycloak.enabled` | Enable Keycloak configuration | `false` | +| Parameter | Description | Default Value | +|-----------------------------------------------|----------------------------------------------------------------------------------------|---------------------------------------------------| +| `wallet.replicaCount` | The amount of replicas to run | `1` | +| `wallet.host` | Hostname for the wallet stub application | `localhost` | +| `wallet.nameSpace` | The namespace | `"wallet"` | +| `wallet.appName` | The application name | `"ssi-dim-wallet-stub"` | +| `wallet.configName` | The configmap name | `"ssi-dim-wallet-config"` | +| `wallet.serviceName` | The service name | `"ssi-dim-wallet-service"` | +| `wallet.secretName` | The secret name | `"ssi-dim-wallet-secret"` | +| `wallet.ingressName` | The ingress name | `"ssi-dim-wallet-ingress"` | +| `wallet.image.repository` | Image repository | `tractusx/managed-identity-wallet` | +| `wallet.image.pullPolicy` | Pull policy for the image | `IfNotPresent` | +| `wallet.image.tag` | Image tag (leave empty to use "appVersion" value from chart definition) | `""` | +| `wallet.resources.requests.cpu` | CPU resource requests | `250m` | +| `wallet.resources.requests.memory` | Memory resource requests | `512Mi` | +| `wallet.resources.limits.cpu` | CPU resource limits | `500m` | +| `wallet.resources.limits.memory` | Memory resource limits | `1Gi` | +| `wallet.livenessProbe.enabled` | Enables/Disables the liveness probe | `true` | +| `wallet.livenessProbe.failureThreshold` | Number of failures before restarting the container | `3` | +| `wallet.livenessProbe.initialDelaySeconds` | Initial delay before starting the liveness probe | `20` | +| `wallet.livenessProbe.timeoutSeconds` | Timeout for the liveness probe | `15` | +| `wallet.livenessProbe.periodSeconds` | How often to perform the liveness probe | `5` | +| `wallet.readinessProbe.enabled` | Enables/Disables the readiness probe | `true` | +| `wallet.readinessProbe.failureThreshold` | Number of failures before marking the Pod as Unready | `3` | +| `wallet.readinessProbe.initialDelaySeconds` | Initial delay before starting the readiness probe | `30` | +| `wallet.readinessProbe.periodSeconds` | How often to perform the readiness probe | `5` | +| `wallet.readinessProbe.successThreshold` | Minimum consecutive successes for the readiness probe to be considered successful | `1` | +| `wallet.readinessProbe.timeoutSeconds` | Timeout for the readiness probe | `5` | +| `wallet.ingress.enabled` | Enable ingress configuration | `false` | +| `wallet.ingress.tls` | Enable TLS for ingress | `false` | +| `wallet.ingress.urlPrefix` | URL prefix for the ingress | `/` | +| `wallet.ingress.className` | Ingress class name | `nginx` | +| `wallet.ingress.annotations` | Annotations for the ingress | `{}` | +| `wallet.swagger.ui.status` | Enable Swagger API documentation UI | `true` | +| `wallet.swagger.apiDoc.status` | Enable OpenAPI documentation | `true` | +| `wallet.logLevel` | Application log level | `"debug"` | +| `wallet.environment` | Name of the landing zone (e.g., dev, int, prod) | `"default"` | +| `wallet.baseWalletBpn` | Operator Business Partner Number (BPN) | `"BPNL000000000000"` | +| `wallet.seeding.bpnList` | List of BPNs for which wallets will be seeded on application startup | `""` | +| `wallet.didHost` | DID document host, used as part of the DID string (e.g., did:web:) | `"localhost"` | +| `wallet.stubUrl` | Wallet stub server URL, used as part of the presentation query API in the DID document | `"http://localhost"` | +| `wallet.statusListVcId` | Default status list Verifiable Credential (VC) ID | `"8a6c7486-1e1f-4555-bdd2-1a178182651e"` | +| `wallet.tokenExpiryTime` | Token expiry time in seconds | `"5"` | +| `wallet.portal.waitTime` | Wait time before pushing data to portal backend after wallet creation | `60` | +| `wallet.portal.host` | Portal backend application host | `"http://localhost"` | +| `wallet.portal.clientId` | Keycloak client ID for accessing portal backend APIs | `"client_id"` | +| `wallet.portal.clientSecret` | Keycloak client secret for accessing portal backend APIs | `"client_secret"` | +| `wallet.keycloak.realm` | Keycloak realm name | `"CX-Central"` | +| `wallet.keycloak.authServerUrl` | Keycloak host URL | `"http://localhost:28080/auth"` | +| `wallet.storageType` | The available storage options are: in-memory or database | `database` | +| `wallet.postgresql.enabled` | Enable PostgraSQL driver, otherwise H2 will be use instead | `true` | +| `wallet.postgresql.url` | The URL to connect to the database | `jdbc:postgresql://wallet-postgres:5432/postgres` | +| `wallet.postgresql.username` | The username to access the database | `postgrespassword` | +| `wallet.postgresql.password` | The password to access the database | `ClusterIP` | +| `wallet.service.type` | Kubernetes service type | `ClusterIP` | +| `wallet.service.port` | Kubernetes service port | `8080` | +| `keycloak.enabled` | Enable Keycloak configuration | `false` | +| `postgresql.fullnameOverride` | Overrides the default PostgreSQL release name with a custom name | `wallet-postgres` | +| `postgresql.enabled` | Enables the deployment of the PostgreSQL instance | `true` | +| `postgresql.image.tag` | Specifies the PostgreSQL Docker image version to use | `15-debian-11` | +| `postgresql.configmap.name` | Name of the ConfigMap containing PostgreSQL configuration | `wallet-postgres-configmap` | +| `postgresql.auth.password` | Password for the PostgreSQL database user | `postgrespassword` | +| `postgresql.auth.username` | Username for the PostgreSQL database | `postgres` | +| `postgresql.primary.persistence.enabled` | Enables persistent storage for PostgreSQL data | `false` | +| `postgresql.primary.persistence.size` | Size of the persistent volume claim (PVC) for PostgreSQL storage | `10Gi` | +| `postgresql.primary.persistence.storageClass` | Specifies the storage class to use for PostgreSQL persistence | `standard` | +| `postgresql.primary.initdb.enabled` | Enables the execution of initialization scripts on PostgreSQL startup | `true` | +| `postgresql.primary.initdb.scripts.init.sql` | SQL script to initialize the database | `{...}` | diff --git a/charts/ssi-dim-wallet-stub/values.yaml b/charts/ssi-dim-wallet-stub/values.yaml index 799a409..0de31e5 100644 --- a/charts/ssi-dim-wallet-stub/values.yaml +++ b/charts/ssi-dim-wallet-stub/values.yaml @@ -142,8 +142,11 @@ wallet: postgresql: # --- Enable PostgraSQL driver, otherwise H2 will be use instead enabled: true + # --- The URL to connect to the database url: jdbc:postgresql://wallet-postgres:5432/postgres + # --- The username to access the database username: postgres + # --- The password to access the database password: postgrespassword # --- Service configuration service: diff --git a/docs/architecture/main.md b/docs/architecture/main.md index 344cef2..a3ddcd5 100644 --- a/docs/architecture/main.md +++ b/docs/architecture/main.md @@ -191,7 +191,7 @@ requested. At the moment simulation of errors are partially covered. * It should be horizontally scalable -* Data will be stored in-memory storage. However, each time when a VP request is made, a VC is created as well. The +* Data will be stored in-memory or in database storage. However, each time when a VP request is made, a VC is created as well. The persistence of signing keys is achieved via creating the keys with seeds derived from the BPN or the issuer and holder. @@ -934,14 +934,16 @@ Response Body: ## Memory Storage -All the data generated during the interaction with Wallet Stub is only used in runtime. The data is kept in memory -during the lifetime of the application. +All data generated during interactions with the Wallet Stub is used only at runtime. +By default, the data is kept in memory for the lifetime of the application. +Alternatively, persistence can be enabled to store the data in a database, ensuring it survives application restarts. ### **Runtime Scenarios** * During the initialization of the Wallet Stub, a base wallet is automatically created by calling the REST API `api/dim/setup-dim`. Subsequently, seeded wallets are created based on the configuration. All the initial setup can be done via configuration file. +*In case persistence is chosen, if the wallet already contains data, no wallets will be created during initialization.* * The VCs are signed at runtime for test purposes @@ -960,7 +962,7 @@ portalWaitTime: ${PORTAL_WAIT_TIME:1000} statusListVcId: ${STATUS_LIST_VC_ID:8a6c7486-1e1f-4555-bdd2-1a178182651e} ``` -* To refresh the memory storage the Wallet Stub service must be restarted. +* To refresh the memory storage the Wallet Stub service must be restarted. In case persistence is activated, the PVC must be removed to clear the stored data. ### **Development Process** @@ -1335,8 +1337,6 @@ client <-- statusListController: VerifiableCredential(http 200) ### Risks: -* Data loss in case the wallet stub service is restarted - * The usage of the wallet stub resources does not guarantee that clients are 100% compatible to a real world wallet implementation