From 96515f856db680b1bd5dafa13295c50d4195a9c3 Mon Sep 17 00:00:00 2001 From: mittal Date: Thu, 13 Jun 2024 15:32:18 +0530 Subject: [PATCH 1/3] fix-dependens-on-validation-issue-service-offer-vc-url-replace-with-id --- .../core/service/service_offer/ServiceOfferService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java index cf79d98..71b6b54 100644 --- a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java +++ b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java @@ -122,7 +122,9 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r request.setCredentialSubject(credentialSubject); Map complianceCredential = this.signerService.signService(participant, request, serviceName); - Credential serviceOffVc = this.credentialService.createCredential(complianceCredential.get(SERVICE_VC), serviceHostUrl, CredentialTypeEnum.SERVICE_OFFER.getCredentialType(), "", participant); + String vcUrl=StringUtils.hasText(request.getCredentialSubject().get("id").toString())?request.getCredentialSubject().get("id").toString():serviceHostUrl; + + Credential serviceOffVc = this.credentialService.createCredential(complianceCredential.get(SERVICE_VC), vcUrl, CredentialTypeEnum.SERVICE_OFFER.getCredentialType(), "", participant); List supportedStandardList = this.getSupportedStandardList(complianceCredential.get(SERVICE_VC)); ServiceOffer serviceOffer = ServiceOffer.builder() From e4d0612c0adaa2691da3170eda10d9d3d8c25e70 Mon Sep 17 00:00:00 2001 From: mittal Date: Thu, 13 Jun 2024 15:40:34 +0530 Subject: [PATCH 2/3] fix-dependens-on-validation-issue-service-offer-vc-url-replace-with-id --- .../wizard/core/service/service_offer/ServiceOfferService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java index 71b6b54..53b60b6 100644 --- a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java +++ b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java @@ -140,7 +140,7 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r serviceOffer = this.serviceOfferRepository.save(serviceOffer); if (!participant.isOwnDidSolution()) { - this.signerService.addServiceEndpoint(participant.getId(), serviceHostUrl, this.serviceEndpointConfig.linkDomainType(), serviceHostUrl); + this.signerService.addServiceEndpoint(participant.getId(), vcUrl, this.serviceEndpointConfig.linkDomainType(), vcUrl); } this.publishService.publishServiceComplianceToMessagingQueue(serviceOffer.getId(), complianceCredential.get(SERVICE_VC)); From bbbba1b06cb666388e25fe17ebb7ab77b6af5652 Mon Sep 17 00:00:00 2001 From: mittal Date: Thu, 13 Jun 2024 15:58:47 +0530 Subject: [PATCH 3/3] fix-dependens-on-validation-issue-service-offer-vc-url-replace-with-id --- .../wizard/core/service/service_offer/PolicyService.java | 2 +- .../core/service/service_offer/ServiceOfferService.java | 8 ++++---- .../gaiax/wizard/core/service/signer/SignerService.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/PolicyService.java b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/PolicyService.java index db71bf7..c633047 100644 --- a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/PolicyService.java +++ b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/PolicyService.java @@ -81,7 +81,7 @@ public void hostPolicy(String hostPolicyJson, String hostedPath) { FileUtils.writeStringToFile(file, hostPolicyJson, Charset.defaultCharset()); this.s3Utils.uploadFile(hostedPath, file); } catch (Exception e) { - log.error("Error while hosting policy json on path " + hostedPath, e); + log.error("Error while hosting policy json on path {}", hostedPath, e); } finally { CommonUtils.deleteFile(file); } diff --git a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java index 53b60b6..fbfcb24 100644 --- a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java +++ b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/service_offer/ServiceOfferService.java @@ -110,7 +110,8 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r } String serviceName = "service_" + this.getRandomString(); - String serviceHostUrl = this.wizardHost + participant.getId() + "/" + serviceName + ".json"; + + String serviceHostUrl = signerService.formServiceOfferingJsonUrl(participant.getDomain(), participant.getId(), serviceName); Map labelLevelVc = this.createServiceOfferLabelLevel(participant, request, serviceHostUrl); Map credentialSubject = request.getCredentialSubject(); @@ -122,9 +123,8 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r request.setCredentialSubject(credentialSubject); Map complianceCredential = this.signerService.signService(participant, request, serviceName); - String vcUrl=StringUtils.hasText(request.getCredentialSubject().get("id").toString())?request.getCredentialSubject().get("id").toString():serviceHostUrl; - Credential serviceOffVc = this.credentialService.createCredential(complianceCredential.get(SERVICE_VC), vcUrl, CredentialTypeEnum.SERVICE_OFFER.getCredentialType(), "", participant); + Credential serviceOffVc = this.credentialService.createCredential(complianceCredential.get(SERVICE_VC), serviceHostUrl, CredentialTypeEnum.SERVICE_OFFER.getCredentialType(), "", participant); List supportedStandardList = this.getSupportedStandardList(complianceCredential.get(SERVICE_VC)); ServiceOffer serviceOffer = ServiceOffer.builder() @@ -140,7 +140,7 @@ public ServiceOfferResponse createServiceOffering(CreateServiceOfferingRequest r serviceOffer = this.serviceOfferRepository.save(serviceOffer); if (!participant.isOwnDidSolution()) { - this.signerService.addServiceEndpoint(participant.getId(), vcUrl, this.serviceEndpointConfig.linkDomainType(), vcUrl); + this.signerService.addServiceEndpoint(participant.getId(), serviceHostUrl, this.serviceEndpointConfig.linkDomainType(), serviceHostUrl); } this.publishService.publishServiceComplianceToMessagingQueue(serviceOffer.getId(), complianceCredential.get(SERVICE_VC)); diff --git a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java index 3ea1176..bbbb761 100644 --- a/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java +++ b/wizard-core/src/main/java/eu/gaiax/wizard/core/service/signer/SignerService.java @@ -173,7 +173,7 @@ private String formParticipantJsonUrl(String domain, UUID participantId) { return this.wizardHost + participantId.toString() + "/" + PARTICIPANT_JSON; } - private String formServiceOfferingJsonUrl(String domain, UUID participantId, String name) { + public String formServiceOfferingJsonUrl(String domain, UUID participantId, String name) { if (StringUtils.hasText(domain)) { return "https://" + domain + "/" + participantId.toString() + "/" + name + JSON_EXTENSION; }