diff --git a/certify-core/src/main/java/io/mosip/certify/core/constants/Constants.java b/certify-core/src/main/java/io/mosip/certify/core/constants/Constants.java index 9f35c439..8e810dcf 100644 --- a/certify-core/src/main/java/io/mosip/certify/core/constants/Constants.java +++ b/certify-core/src/main/java/io/mosip/certify/core/constants/Constants.java @@ -9,6 +9,8 @@ public class Constants { public static final String UTC_DATETIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; public static final String SPACE = " "; + public static final String APPLICATION_ID = "applicationId"; + public static final String REFERENCE_ID = "referenceId"; public static final String C_NONCE = "c_nonce"; public static final String C_NONCE_EXPIRES_IN = "c_nonce_expires_in"; @@ -20,4 +22,7 @@ public class Constants { public static final String ROOT_KEY = "ROOT"; public static final String EMPTY_REF_ID = ""; public static final String ED25519_REF_ID = "ED25519_SIGN"; + public static final String TEMPLATE_NAME = "templateName"; + public static final String ISSUER_URI = "issuerURI"; + public static final String RENDERING_TEMPLATE_ID = "renderingTemplateId"; } diff --git a/certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java b/certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java index f3fcb21c..4c5957dd 100644 --- a/certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java +++ b/certify-core/src/main/java/io/mosip/certify/core/constants/ErrorConstants.java @@ -25,4 +25,5 @@ public class ErrorConstants { public static final String UNSUPPORTED_OPENID_VERSION = "unsupported_openid4vci_version"; public static final String INVALID_TEMPLATE_ID = "template_with_id_not_found"; public static final String EMPTY_TEMPLATE_CONTENT = "empty_template_content"; + public static final String EXPECTED_TEMPLATE_NOT_FOUND = "expected_template_not_found"; } diff --git a/certify-core/src/main/java/io/mosip/certify/core/exception/RenderingTemplateException.java b/certify-core/src/main/java/io/mosip/certify/core/exception/RenderingTemplateException.java index f04579b7..423d28bc 100644 --- a/certify-core/src/main/java/io/mosip/certify/core/exception/RenderingTemplateException.java +++ b/certify-core/src/main/java/io/mosip/certify/core/exception/RenderingTemplateException.java @@ -1,15 +1,8 @@ package io.mosip.certify.core.exception; -import io.mosip.certify.core.constants.ErrorConstants; - public class RenderingTemplateException extends RuntimeException { private String errorCode; - public RenderingTemplateException() { - super(ErrorConstants.UNKNOWN_ERROR); - this.errorCode = ErrorConstants.UNKNOWN_ERROR; - } - public RenderingTemplateException(String errorCode) { super(errorCode); this.errorCode = errorCode; diff --git a/certify-service/src/main/java/io/mosip/certify/services/spi/RenderingTemplateService.java b/certify-core/src/main/java/io/mosip/certify/core/spi/RenderingTemplateService.java similarity index 90% rename from certify-service/src/main/java/io/mosip/certify/services/spi/RenderingTemplateService.java rename to certify-core/src/main/java/io/mosip/certify/core/spi/RenderingTemplateService.java index f2b487c0..07b31647 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/spi/RenderingTemplateService.java +++ b/certify-core/src/main/java/io/mosip/certify/core/spi/RenderingTemplateService.java @@ -3,11 +3,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package io.mosip.certify.services.spi; +package io.mosip.certify.core.spi; import io.mosip.certify.api.dto.RenderingTemplateDTO; - public interface RenderingTemplateService { RenderingTemplateDTO getSvgTemplate(String id); } diff --git a/certify-service/src/main/java/io/mosip/certify/services/spi/DataProviderPlugin.java b/certify-integration-api/src/main/java/io/mosip/certify/api/spi/DataProviderPlugin.java similarity index 79% rename from certify-service/src/main/java/io/mosip/certify/services/spi/DataProviderPlugin.java rename to certify-integration-api/src/main/java/io/mosip/certify/api/spi/DataProviderPlugin.java index 522b0be4..239ad7d8 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/spi/DataProviderPlugin.java +++ b/certify-integration-api/src/main/java/io/mosip/certify/api/spi/DataProviderPlugin.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.spi; +package io.mosip.certify.api.spi; import io.mosip.certify.api.exception.DataProviderExchangeException; import org.json.JSONObject; @@ -7,7 +7,7 @@ /** * DataProviderPlugin is implemented by VC plugin - * implementors who want to make use of the CertifyIssuer to generate the VC. + * implementors who want to make use of the Certify to generate the VC. * Data is fetched from a Plugin implementation, templated using {@link VCFormatter} * and then signed using {@link VCSigner}. */ diff --git a/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java b/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java index 308d4059..134bc317 100644 --- a/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java +++ b/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java @@ -14,8 +14,6 @@ @EnableAsync @EnableCaching @SpringBootApplication(scanBasePackages = "io.mosip.certify,"+ - "io.mosip.certify.services.repository," + - "io.mosip.certify.services.entity," + "io.mosip.kernel.crypto," + "io.mosip.kernel.keymanager.hsm," + "io.mosip.kernel.cryptomanager," + diff --git a/certify-service/src/main/java/io/mosip/certify/config/AppConfig.java b/certify-service/src/main/java/io/mosip/certify/config/AppConfig.java index 2f34a1ec..451e6ee0 100644 --- a/certify-service/src/main/java/io/mosip/certify/config/AppConfig.java +++ b/certify-service/src/main/java/io/mosip/certify/config/AppConfig.java @@ -30,8 +30,8 @@ import org.springframework.web.client.RestTemplate; @Configuration -@EnableJpaRepositories(basePackages = {"io.mosip.kernel.keymanagerservice.repository", "io.mosip.certify.services.repository"}) -@EntityScan(basePackages = {"io.mosip.kernel.keymanagerservice.entity, io.mosip.certify.services.entity"}) +@EnableJpaRepositories(basePackages = {"io.mosip.kernel.keymanagerservice.repository", "io.mosip.certify.repository"}) +@EntityScan(basePackages = {"io.mosip.kernel.keymanagerservice.entity, io.mosip.certify.entity"}) @Slf4j public class AppConfig implements ApplicationRunner { diff --git a/certify-service/src/main/java/io/mosip/certify/controller/RenderingTemplateController.java b/certify-service/src/main/java/io/mosip/certify/controller/RenderingTemplateController.java index 41178d55..e9c3c4c4 100644 --- a/certify-service/src/main/java/io/mosip/certify/controller/RenderingTemplateController.java +++ b/certify-service/src/main/java/io/mosip/certify/controller/RenderingTemplateController.java @@ -6,9 +6,8 @@ package io.mosip.certify.controller; import io.mosip.certify.api.dto.RenderingTemplateDTO; -import io.mosip.certify.services.entity.RenderingTemplate; import io.mosip.certify.core.exception.RenderingTemplateException; -import io.mosip.certify.services.spi.RenderingTemplateService; +import io.mosip.certify.core.spi.RenderingTemplateService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -25,14 +24,14 @@ @Slf4j @RestController -@RequestMapping("/public") +@RequestMapping("/rendering-template") public class RenderingTemplateController { @Value("${mosip.certify.rendering-template.cache-max-age-days:1}") Integer maxAgeDays; @Autowired RenderingTemplateService renderingTemplateService; - @GetMapping("/rendering-template/{id}") + @GetMapping("/{id}") public ResponseEntity serveSvgTemplate(@PathVariable String id) throws RenderingTemplateException { RenderingTemplateDTO template = renderingTemplateService.getSvgTemplate(id); return ResponseEntity.ok() diff --git a/certify-service/src/main/java/io/mosip/certify/services/entity/CredentialTemplate.java b/certify-service/src/main/java/io/mosip/certify/entity/CredentialTemplate.java similarity index 94% rename from certify-service/src/main/java/io/mosip/certify/services/entity/CredentialTemplate.java rename to certify-service/src/main/java/io/mosip/certify/entity/CredentialTemplate.java index 3a8b8724..b8b40080 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/entity/CredentialTemplate.java +++ b/certify-service/src/main/java/io/mosip/certify/entity/CredentialTemplate.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.entity; +package io.mosip.certify.entity; import jakarta.persistence.Entity; diff --git a/certify-service/src/main/java/io/mosip/certify/services/entity/RenderingTemplate.java b/certify-service/src/main/java/io/mosip/certify/entity/RenderingTemplate.java similarity index 95% rename from certify-service/src/main/java/io/mosip/certify/services/entity/RenderingTemplate.java rename to certify-service/src/main/java/io/mosip/certify/entity/RenderingTemplate.java index ed0961e6..8a113231 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/entity/RenderingTemplate.java +++ b/certify-service/src/main/java/io/mosip/certify/entity/RenderingTemplate.java @@ -3,7 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package io.mosip.certify.services.entity; +package io.mosip.certify.entity; import io.mosip.certify.core.constants.ErrorConstants; import jakarta.persistence.*; diff --git a/certify-service/src/main/java/io/mosip/certify/services/entity/TemplateId.java b/certify-service/src/main/java/io/mosip/certify/entity/TemplateId.java similarity index 93% rename from certify-service/src/main/java/io/mosip/certify/services/entity/TemplateId.java rename to certify-service/src/main/java/io/mosip/certify/entity/TemplateId.java index 9280547c..7e99274d 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/entity/TemplateId.java +++ b/certify-service/src/main/java/io/mosip/certify/entity/TemplateId.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.entity; +package io.mosip.certify.entity; import lombok.*; diff --git a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/Ed25519Signature2018ProofGenerator.java b/certify-service/src/main/java/io/mosip/certify/proofgenerators/Ed25519Signature2018ProofGenerator.java similarity index 90% rename from certify-service/src/main/java/io/mosip/certify/services/proofgenerators/Ed25519Signature2018ProofGenerator.java rename to certify-service/src/main/java/io/mosip/certify/proofgenerators/Ed25519Signature2018ProofGenerator.java index d74b72b3..9f8c43e3 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/Ed25519Signature2018ProofGenerator.java +++ b/certify-service/src/main/java/io/mosip/certify/proofgenerators/Ed25519Signature2018ProofGenerator.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.proofgenerators; +package io.mosip.certify.proofgenerators; import com.danubetech.keyformats.jose.JWSAlgorithm; import info.weboftrust.ldsignatures.LdProof; @@ -13,6 +13,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; +import java.util.Map; + /** * Ed25519SignatureAlgorithm2018 as per https://w3c-ccg.github.io/lds-ed25519-2018/ */ @@ -35,9 +37,11 @@ public Canonicalizer getCanonicalizer() { } @Override - public LdProof generateProof(LdProof vcLdProof, String vcEncodedHash) { + public LdProof generateProof(LdProof vcLdProof, String vcEncodedHash, Map keyID) { JWSSignatureRequestDto payload = new JWSSignatureRequestDto(); payload.setDataToSign(vcEncodedHash); + payload.setApplicationId(keyID.get(Constants.APPLICATION_ID)); + payload.setReferenceId(keyID.get(Constants.REFERENCE_ID)); payload.setApplicationId(Constants.CERTIFY_VC_SIGN_ED25519); payload.setReferenceId(Constants.ED25519_REF_ID); // alg, empty = RSA payload.setIncludePayload(false); diff --git a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/Ed25519Signature2020ProofGenerator.java b/certify-service/src/main/java/io/mosip/certify/proofgenerators/Ed25519Signature2020ProofGenerator.java similarity index 86% rename from certify-service/src/main/java/io/mosip/certify/services/proofgenerators/Ed25519Signature2020ProofGenerator.java rename to certify-service/src/main/java/io/mosip/certify/proofgenerators/Ed25519Signature2020ProofGenerator.java index a291d081..33f3c6cb 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/Ed25519Signature2020ProofGenerator.java +++ b/certify-service/src/main/java/io/mosip/certify/proofgenerators/Ed25519Signature2020ProofGenerator.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.proofgenerators; +package io.mosip.certify.proofgenerators; import com.danubetech.keyformats.jose.JWSAlgorithm; import info.weboftrust.ldsignatures.LdProof; @@ -10,9 +10,12 @@ import io.mosip.kernel.signature.dto.SignResponseDto; import io.mosip.kernel.signature.service.SignatureServicev2; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; +import java.util.Map; + /** * Ed25519SignatureAlgorithm2020 as per * https://www.w3.org/community/reports/credentials/CG-FINAL-di-eddsa-2020-20220724/ @@ -37,8 +40,10 @@ public Canonicalizer getCanonicalizer() { } @Override - public LdProof generateProof(LdProof vcLdProof, String vcEncodedHash) { + public LdProof generateProof(LdProof vcLdProof, String vcEncodedHash, Map keyID) { SignRequestDtoV2 srd = new SignRequestDtoV2(); + srd.setApplicationId(keyID.get(Constants.APPLICATION_ID)); + srd.setReferenceId(keyID.get(Constants.REFERENCE_ID)); srd.setApplicationId(Constants.CERTIFY_VC_SIGN_ED25519); srd.setReferenceId(Constants.ED25519_REF_ID); srd.setDataToSign(vcEncodedHash); diff --git a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/ProofGenerator.java b/certify-service/src/main/java/io/mosip/certify/proofgenerators/ProofGenerator.java similarity index 84% rename from certify-service/src/main/java/io/mosip/certify/services/proofgenerators/ProofGenerator.java rename to certify-service/src/main/java/io/mosip/certify/proofgenerators/ProofGenerator.java index e9dd9d58..e1e03257 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/ProofGenerator.java +++ b/certify-service/src/main/java/io/mosip/certify/proofgenerators/ProofGenerator.java @@ -1,8 +1,10 @@ -package io.mosip.certify.services.proofgenerators; +package io.mosip.certify.proofgenerators; import info.weboftrust.ldsignatures.LdProof; import info.weboftrust.ldsignatures.canonicalizer.Canonicalizer; +import java.util.Map; + /** * ProofGenerator is a helper class for KeymanagerLibSigner * to better deal with multiple signature algorithms for JSON-LD VCs. @@ -27,5 +29,5 @@ public interface ProofGenerator { * @param vcHash is the output of the * @return */ - LdProof generateProof(LdProof vcLdProof, String vcHash); + LdProof generateProof(LdProof vcLdProof, String vcHash, Map keyID); } diff --git a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/RSASignature2018ProofGenerator.java b/certify-service/src/main/java/io/mosip/certify/proofgenerators/RSASignature2018ProofGenerator.java similarity index 89% rename from certify-service/src/main/java/io/mosip/certify/services/proofgenerators/RSASignature2018ProofGenerator.java rename to certify-service/src/main/java/io/mosip/certify/proofgenerators/RSASignature2018ProofGenerator.java index 4753eaa5..02349473 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/proofgenerators/RSASignature2018ProofGenerator.java +++ b/certify-service/src/main/java/io/mosip/certify/proofgenerators/RSASignature2018ProofGenerator.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.proofgenerators; +package io.mosip.certify.proofgenerators; import com.danubetech.keyformats.jose.JWSAlgorithm; import info.weboftrust.ldsignatures.LdProof; @@ -15,6 +15,7 @@ import java.nio.charset.StandardCharsets; import java.util.Base64; +import java.util.Map; @Component @ConditionalOnProperty(name = "mosip.certify.data-provider-plugin.issuer.vc-sign-algo", havingValue = SignatureAlg.RSA_SIGNATURE_SUITE_2018) @@ -35,12 +36,12 @@ public Canonicalizer getCanonicalizer() { } @Override - public LdProof generateProof(LdProof vcLdProof, String vcEncodedHash) { + public LdProof generateProof(LdProof vcLdProof, String vcEncodedHash, Map keyID) { String vcEncodedData = Base64.getUrlEncoder().encodeToString(vcEncodedHash.getBytes(StandardCharsets.UTF_8)); JWSSignatureRequestDto payload = new JWSSignatureRequestDto(); payload.setDataToSign(vcEncodedData); - payload.setApplicationId(Constants.CERTIFY_VC_SIGN_RSA); - payload.setReferenceId(Constants.EMPTY_REF_ID); // alg, empty = RSA + payload.setApplicationId(keyID.get(Constants.APPLICATION_ID)); + payload.setReferenceId(keyID.get(Constants.REFERENCE_ID)); // alg, empty = RSA payload.setIncludePayload(false); payload.setIncludeCertificate(false); payload.setIncludeCertHash(true); diff --git a/certify-service/src/main/java/io/mosip/certify/services/repository/TemplateRepository.java b/certify-service/src/main/java/io/mosip/certify/repository/CredentialTemplateRepository.java similarity index 54% rename from certify-service/src/main/java/io/mosip/certify/services/repository/TemplateRepository.java rename to certify-service/src/main/java/io/mosip/certify/repository/CredentialTemplateRepository.java index c1f48e22..d290641a 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/repository/TemplateRepository.java +++ b/certify-service/src/main/java/io/mosip/certify/repository/CredentialTemplateRepository.java @@ -1,14 +1,14 @@ -package io.mosip.certify.services.repository; +package io.mosip.certify.repository; -import io.mosip.certify.services.entity.CredentialTemplate; -import io.mosip.certify.services.entity.TemplateId; +import io.mosip.certify.entity.CredentialTemplate; +import io.mosip.certify.entity.TemplateId; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.Optional; @Repository -public interface TemplateRepository extends JpaRepository { +public interface CredentialTemplateRepository extends JpaRepository { Optional findByCredentialTypeAndContext(String credentialType, String context); // NOTE: best practice? .save() } diff --git a/certify-service/src/main/java/io/mosip/certify/services/repository/RenderingTemplateRepository.java b/certify-service/src/main/java/io/mosip/certify/repository/RenderingTemplateRepository.java similarity index 77% rename from certify-service/src/main/java/io/mosip/certify/services/repository/RenderingTemplateRepository.java rename to certify-service/src/main/java/io/mosip/certify/repository/RenderingTemplateRepository.java index 4868dc54..43456a33 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/repository/RenderingTemplateRepository.java +++ b/certify-service/src/main/java/io/mosip/certify/repository/RenderingTemplateRepository.java @@ -3,9 +3,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package io.mosip.certify.services.repository; +package io.mosip.certify.repository; -import io.mosip.certify.services.entity.RenderingTemplate; +import io.mosip.certify.entity.RenderingTemplate; import org.springframework.data.jpa.repository.JpaRepository; public interface RenderingTemplateRepository extends JpaRepository { diff --git a/certify-service/src/main/java/io/mosip/certify/services/CertifyIssuanceServiceImpl.java b/certify-service/src/main/java/io/mosip/certify/services/CertifyIssuanceServiceImpl.java index 0ae39af1..6b6b5260 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/CertifyIssuanceServiceImpl.java +++ b/certify-service/src/main/java/io/mosip/certify/services/CertifyIssuanceServiceImpl.java @@ -12,6 +12,7 @@ import io.mosip.certify.api.spi.*; import io.mosip.certify.api.util.Action; import io.mosip.certify.api.util.ActionStatus; +import io.mosip.certify.core.constants.SignatureAlg; import io.mosip.certify.core.constants.VCFormats; import io.mosip.certify.core.dto.CredentialMetadata; import io.mosip.certify.core.dto.CredentialRequest; @@ -26,15 +27,14 @@ import io.mosip.certify.core.spi.VCIssuanceService; import io.mosip.certify.core.util.AuditHelper; import io.mosip.certify.core.util.SecurityHelperService; -import io.mosip.certify.services.spi.DataProviderPlugin; -import io.mosip.certify.services.spi.VCFormatter; -import io.mosip.certify.services.spi.VCSigner; -import io.mosip.certify.services.validators.CredentialRequestValidator; +import io.mosip.certify.api.spi.DataProviderPlugin; +import io.mosip.certify.vcformatters.VCFormatter; +import io.mosip.certify.validators.CredentialRequestValidator; import io.mosip.certify.exception.InvalidNonceException; import io.mosip.certify.proof.ProofValidator; import io.mosip.certify.proof.ProofValidatorFactory; -import io.mosip.certify.services.templating.VelocityTemplatingConstants; import io.mosip.certify.utils.CredentialUtils; +import io.mosip.certify.vcsigners.VCSigner; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; @@ -50,9 +50,15 @@ @Slf4j @Service -@ConditionalOnProperty(value = "mosip.certify.issuer", havingValue = "CertifyIssuer") +@ConditionalOnProperty(value = "mosip.certify.plugin-mode", havingValue = "DataProvider") public class CertifyIssuanceServiceImpl implements VCIssuanceService { + public static final Map> keyChooser = Map.of( + SignatureAlg.RSA_SIGNATURE_SUITE_2018, List.of(Constants.CERTIFY_VC_SIGN_RSA, Constants.EMPTY_REF_ID), + SignatureAlg.ED25519_SIGNATURE_SUITE_2018, List.of(Constants.CERTIFY_VC_SIGN_ED25519, Constants.ED25519_REF_ID), + SignatureAlg.ED25519_SIGNATURE_SUITE_2020, List.of(Constants.CERTIFY_VC_SIGN_ED25519, Constants.ED25519_REF_ID)); + @Value("${mosip.certify.data-provider-plugin.issuer.vc-sign-algo:Ed25519Signature2020}") + private String vcSignAlgorithm; @Value("#{${mosip.certify.key-values}}") private LinkedHashMap> issuerMetadata; @@ -283,13 +289,17 @@ private VCResult getVerifiableCredential(CredentialRequest credentialRequest, // TODO(multitenancy): later decide which plugin out of n plugins is the correct one JSONObject jsonObject = dataProviderPlugin.fetchData(parsedAccessToken.getClaims()); Map templateParams = new HashMap<>(); - templateParams.put(VelocityTemplatingConstants.TEMPLATE_NAME, CredentialUtils.getTemplateName(vcRequestDto)); - templateParams.put(VelocityTemplatingConstants.ISSUER_URI, issuerURI); + templateParams.put(Constants.TEMPLATE_NAME, CredentialUtils.getTemplateName(vcRequestDto)); + templateParams.put(Constants.ISSUER_URI, issuerURI); if (!StringUtils.isEmpty(renderTemplateId)) { - templateParams.put(VelocityTemplatingConstants.SVG_TEMPLATE, renderTemplateId); + templateParams.put(Constants.RENDERING_TEMPLATE_ID, renderTemplateId); } String unSignedVC = vcFormatter.format(jsonObject, templateParams); - vcResult = vcSigner.attachSignature(unSignedVC); + Map signerSettings = new HashMap<>(); + // NOTE: This is a quasi implementation to add support for multi-tenancy. + signerSettings.put(Constants.APPLICATION_ID, keyChooser.get(vcSignAlgorithm).getFirst()); + signerSettings.put(Constants.REFERENCE_ID, keyChooser.get(vcSignAlgorithm).getLast()); + vcResult = vcSigner.attachSignature(unSignedVC, signerSettings); } catch(DataProviderExchangeException e) { throw new CertifyException(e.getErrorCode()); } diff --git a/certify-service/src/main/java/io/mosip/certify/services/RenderingTemplateServiceImpl.java b/certify-service/src/main/java/io/mosip/certify/services/RenderingTemplateServiceImpl.java index edc7c6f5..f2245cd5 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/RenderingTemplateServiceImpl.java +++ b/certify-service/src/main/java/io/mosip/certify/services/RenderingTemplateServiceImpl.java @@ -7,10 +7,10 @@ import io.mosip.certify.api.dto.RenderingTemplateDTO; import io.mosip.certify.core.constants.ErrorConstants; -import io.mosip.certify.services.entity.RenderingTemplate; +import io.mosip.certify.entity.RenderingTemplate; import io.mosip.certify.core.exception.RenderingTemplateException; -import io.mosip.certify.services.repository.RenderingTemplateRepository; -import io.mosip.certify.services.spi.RenderingTemplateService; +import io.mosip.certify.repository.RenderingTemplateRepository; +import io.mosip.certify.core.spi.RenderingTemplateService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -35,6 +35,5 @@ public RenderingTemplateDTO getSvgTemplate(String id) { renderingTemplateDTO.setUpdatedTimes(renderingTemplate.getUpdatedtimes()); return renderingTemplateDTO; - } } diff --git a/certify-service/src/main/java/io/mosip/certify/services/VCIssuanceServiceImpl.java b/certify-service/src/main/java/io/mosip/certify/services/VCIssuanceServiceImpl.java index 40b9e854..f8df8ade 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/VCIssuanceServiceImpl.java +++ b/certify-service/src/main/java/io/mosip/certify/services/VCIssuanceServiceImpl.java @@ -28,7 +28,7 @@ import io.mosip.certify.core.spi.VCIssuanceService; import io.mosip.certify.core.util.AuditHelper; import io.mosip.certify.core.util.SecurityHelperService; -import io.mosip.certify.services.validators.CredentialRequestValidator; +import io.mosip.certify.validators.CredentialRequestValidator; import io.mosip.certify.exception.InvalidNonceException; import io.mosip.certify.proof.ProofValidator; import io.mosip.certify.proof.ProofValidatorFactory; @@ -45,7 +45,7 @@ @Slf4j @Service -@ConditionalOnProperty(value = "mosip.certify.issuer", havingValue = "PluginIssuer") +@ConditionalOnProperty(value = "mosip.certify.plugin-mode", havingValue = "VCIssuance") public class VCIssuanceServiceImpl implements VCIssuanceService { @Value("#{${mosip.certify.key-values}}") diff --git a/certify-service/src/main/java/io/mosip/certify/services/templating/VelocityTemplatingConstants.java b/certify-service/src/main/java/io/mosip/certify/services/templating/VelocityTemplatingConstants.java deleted file mode 100644 index 3c33ce94..00000000 --- a/certify-service/src/main/java/io/mosip/certify/services/templating/VelocityTemplatingConstants.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.mosip.certify.services.templating; - -public class VelocityTemplatingConstants { - public static final String TEMPLATE_NAME = "templateName"; - public static final String ISSUER_URI = "issuerURI"; - public static final String SVG_TEMPLATE = "svgTemplate"; -} diff --git a/certify-service/src/main/java/io/mosip/certify/services/validators/CredentialRequestValidator.java b/certify-service/src/main/java/io/mosip/certify/validators/CredentialRequestValidator.java similarity index 92% rename from certify-service/src/main/java/io/mosip/certify/services/validators/CredentialRequestValidator.java rename to certify-service/src/main/java/io/mosip/certify/validators/CredentialRequestValidator.java index 0b938c60..84872b9e 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/validators/CredentialRequestValidator.java +++ b/certify-service/src/main/java/io/mosip/certify/validators/CredentialRequestValidator.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.validators; +package io.mosip.certify.validators; import io.mosip.certify.core.constants.VCFormats; import io.mosip.certify.core.dto.CredentialRequest; diff --git a/certify-service/src/main/java/io/mosip/certify/services/validators/LdpVcCredentialRequestValidator.java b/certify-service/src/main/java/io/mosip/certify/validators/LdpVcCredentialRequestValidator.java similarity index 84% rename from certify-service/src/main/java/io/mosip/certify/services/validators/LdpVcCredentialRequestValidator.java rename to certify-service/src/main/java/io/mosip/certify/validators/LdpVcCredentialRequestValidator.java index bb6e2d90..9e5f4ece 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/validators/LdpVcCredentialRequestValidator.java +++ b/certify-service/src/main/java/io/mosip/certify/validators/LdpVcCredentialRequestValidator.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.validators; +package io.mosip.certify.validators; import io.mosip.certify.core.dto.CredentialRequest; diff --git a/certify-service/src/main/java/io/mosip/certify/services/validators/MsoMdocCredentialRequestValidator.java b/certify-service/src/main/java/io/mosip/certify/validators/MsoMdocCredentialRequestValidator.java similarity index 90% rename from certify-service/src/main/java/io/mosip/certify/services/validators/MsoMdocCredentialRequestValidator.java rename to certify-service/src/main/java/io/mosip/certify/validators/MsoMdocCredentialRequestValidator.java index dcd88cc5..0e9d91c1 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/validators/MsoMdocCredentialRequestValidator.java +++ b/certify-service/src/main/java/io/mosip/certify/validators/MsoMdocCredentialRequestValidator.java @@ -1,4 +1,4 @@ -package io.mosip.certify.services.validators; +package io.mosip.certify.validators; import io.mosip.certify.core.dto.CredentialRequest; diff --git a/certify-service/src/main/java/io/mosip/certify/services/spi/VCFormatter.java b/certify-service/src/main/java/io/mosip/certify/vcformatters/VCFormatter.java similarity index 69% rename from certify-service/src/main/java/io/mosip/certify/services/spi/VCFormatter.java rename to certify-service/src/main/java/io/mosip/certify/vcformatters/VCFormatter.java index 18fc37e5..5acb21ef 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/spi/VCFormatter.java +++ b/certify-service/src/main/java/io/mosip/certify/vcformatters/VCFormatter.java @@ -1,9 +1,8 @@ -package io.mosip.certify.services.spi; +package io.mosip.certify.vcformatters; +import java.util.Map; import org.json.JSONObject; - -import java.util.Map; /** * VCDataModelFormatter is a templating engine which takes @param templateInput and returns a templated VC. * Some implementations include @@ -17,12 +16,4 @@ public interface VCFormatter { * @return a templated & unsigned VC */ String format(JSONObject valueMap, Map templateSettings); - - /** - * an internal method for VCFormatters to fetch a VC template as per the key - * - * @param key an identifier for a VC template - * @return Template String against a @param key - */ - String getTemplate(String key); } \ No newline at end of file diff --git a/certify-service/src/main/java/io/mosip/certify/services/templating/VelocityTemplatingEngineImpl.java b/certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java similarity index 77% rename from certify-service/src/main/java/io/mosip/certify/services/templating/VelocityTemplatingEngineImpl.java rename to certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java index 5cc0684f..3b7d8e00 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/templating/VelocityTemplatingEngineImpl.java +++ b/certify-service/src/main/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImpl.java @@ -3,22 +3,25 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package io.mosip.certify.services.templating; +package io.mosip.certify.vcformatters; import java.io.*; +import java.time.Duration; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.*; -import io.mosip.certify.services.entity.CredentialTemplate; -import io.mosip.certify.services.spi.VCFormatter; +import io.mosip.certify.core.constants.ErrorConstants; +import io.mosip.certify.core.exception.CertifyException; +import io.mosip.certify.entity.CredentialTemplate; import io.mosip.certify.core.constants.Constants; import io.mosip.certify.core.constants.VCDM2Constants; import io.mosip.certify.core.constants.VCDMConstants; import io.mosip.certify.core.exception.RenderingTemplateException; -import io.mosip.certify.services.repository.TemplateRepository; -import io.mosip.certify.services.spi.RenderingTemplateService; +import io.mosip.certify.repository.CredentialTemplateRepository; +import io.mosip.certify.core.spi.RenderingTemplateService; import io.mosip.certify.services.CredentialUtils; import jakarta.annotation.PostConstruct; import lombok.SneakyThrows; @@ -36,8 +39,6 @@ import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; -import static io.mosip.certify.services.templating.VelocityTemplatingConstants.*; - @Slf4j @Service public class VelocityTemplatingEngineImpl implements VCFormatter { @@ -45,11 +46,13 @@ public class VelocityTemplatingEngineImpl implements VCFormatter { public static final String DELIMITER = ":"; public static final String TEMPLATE_CACHE = "templatecache"; @Autowired - TemplateRepository templateRepository; + CredentialTemplateRepository credentialTemplateRepository; @Autowired RenderingTemplateService renderingTemplateService; - @Value("${mosip.certify.vcformat.vc.expiry:true}") - boolean shouldHaveDates; + + @Value("${mosip.certify.data-provider-plugin.vc-expiry-duration:P730d}") + String defaultExpiryDuration; + @Value("${mosip.certify.issuer.id.field.prefix.url:}") String idPrefix; @@ -79,13 +82,13 @@ public void initialize() { @Override public String format(JSONObject valueMap, Map templateSettings) { // TODO: Isn't template name becoming too complex with VC_CONTEXTS & CREDENTIAL_TYPES both? - String templateName = templateSettings.get(TEMPLATE_NAME).toString(); + String templateName = templateSettings.get(Constants.TEMPLATE_NAME).toString(); String template = getTemplate(templateName); if (template == null) { log.error("Template {} not found", templateName); - throw new RenderingTemplateException("Expected template not found"); + throw new CertifyException(ErrorConstants.EXPECTED_TEMPLATE_NOT_FOUND); } - String issuer = templateSettings.get(ISSUER_URI).toString(); + String issuer = templateSettings.get(Constants.ISSUER_URI).toString(); StringWriter writer = new StringWriter(); // 1. Prepare map // TODO: Eventually, the credentialSubject from the plugin will be templated as-is @@ -113,22 +116,25 @@ public String format(JSONObject valueMap, Map templateSettings) // Escape: https://velocity.apache.org/tools/3.1/apidocs/org/apache/velocity/tools/generic/EscapeTool.html finalTemplate.put("_esc", new EscapeTool()); // add the issuer value - finalTemplate.put("issuer", issuer); - if (templateSettings.containsKey(SVG_TEMPLATE) && templateName.contains(VCDM2Constants.URL)) { + finalTemplate.put("_issuer", issuer); + if (templateSettings.containsKey(Constants.RENDERING_TEMPLATE_ID) && templateName.contains(VCDM2Constants.URL)) { try { finalTemplate.put("_renderMethodSVGdigest", CredentialUtils.getDigestMultibase(renderingTemplateService.getSvgTemplate( - (String) templateSettings.get(SVG_TEMPLATE)).getTemplate())); + (String) templateSettings.get(Constants.RENDERING_TEMPLATE_ID)).getTemplate())); } catch (RenderingTemplateException e) { - log.error("SVG Template: " + templateSettings.get(SVG_TEMPLATE) + " not available in DB", e); + log.error("SVG Template: " + templateSettings.get(Constants.RENDERING_TEMPLATE_ID) + " not available in DB", e); } } - if (shouldHaveDates && !(valueMap.has(VCDM2Constants.VALID_FROM) - && valueMap.has(VCDM2Constants.VALID_UNITL))) { - String time = ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern(Constants.UTC_DATETIME_PATTERN)); - // hardcoded time - String expiryTime = ZonedDateTime.now(ZoneOffset.UTC).plusYears(2).format(DateTimeFormatter.ofPattern(Constants.UTC_DATETIME_PATTERN)); - finalTemplate.put(VCDM2Constants.VALID_FROM, time); + if (!valueMap.has(VCDM2Constants.VALID_UNITL) && StringUtils.isNotEmpty(defaultExpiryDuration)) { + Duration duration; + try { + duration = Duration.parse(defaultExpiryDuration); + } catch (DateTimeParseException e) { + // set 730days(~2Y) as default VC expiry + duration = Duration.parse("P730D"); + } + String expiryTime = ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(duration.getSeconds()).format(DateTimeFormatter.ofPattern(Constants.UTC_DATETIME_PATTERN)); finalTemplate.put(VCDM2Constants.VALID_UNITL, expiryTime); } VelocityContext context = new VelocityContext(finalTemplate); @@ -147,7 +153,6 @@ public String format(JSONObject valueMap, Map templateSettings) * context separated by a ':'. * @return */ - @Override @Cacheable(cacheNames = TEMPLATE_CACHE, key = "#key") public String getTemplate(String key) { if (!key.contains(DELIMITER)) { @@ -155,7 +160,7 @@ public String getTemplate(String key) { } String credentialType = key.split(DELIMITER)[0]; String context = key.split(DELIMITER, 2)[1]; - CredentialTemplate template = templateRepository.findByCredentialTypeAndContext(credentialType, context).orElse(null); + CredentialTemplate template = credentialTemplateRepository.findByCredentialTypeAndContext(credentialType, context).orElse(null); if (template != null) { return template.getTemplate(); } else diff --git a/certify-service/src/main/java/io/mosip/certify/services/KeymanagerLibSigner.java b/certify-service/src/main/java/io/mosip/certify/vcsigners/JsonLDVCSigner.java similarity index 92% rename from certify-service/src/main/java/io/mosip/certify/services/KeymanagerLibSigner.java rename to certify-service/src/main/java/io/mosip/certify/vcsigners/JsonLDVCSigner.java index 6dfac8ba..eb910daa 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/KeymanagerLibSigner.java +++ b/certify-service/src/main/java/io/mosip/certify/vcsigners/JsonLDVCSigner.java @@ -3,17 +3,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -package io.mosip.certify.services; +package io.mosip.certify.vcsigners; import foundation.identity.jsonld.JsonLDException; import foundation.identity.jsonld.JsonLDObject; import info.weboftrust.ldsignatures.LdProof; import info.weboftrust.ldsignatures.canonicalizer.Canonicalizer; import io.mosip.certify.api.dto.VCResult; -import io.mosip.certify.services.spi.VCSigner; import io.mosip.certify.core.constants.*; import io.mosip.certify.core.exception.CertifyException; -import io.mosip.certify.services.proofgenerators.ProofGenerator; +import io.mosip.certify.proofgenerators.ProofGenerator; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -29,9 +28,10 @@ import java.time.format.DateTimeFormatter; import java.util.Base64; import java.util.Date; +import java.util.Map; /** - * KeymanagerLibSigner is a VCSigner which uses the Certify embedded + * JsonLDVCSigner is a VCSigner which uses the Certify embedded * keymanager to perform VC signing tasks for JSON LD VCs. * These are the known external requirements: * - the public key must be pre-hosted for the VC & should be available @@ -41,7 +41,7 @@ */ @Slf4j @Service -public class KeymanagerLibSigner implements VCSigner { +public class JsonLDVCSigner implements VCSigner { @Autowired ProofGenerator proofGenerator; @@ -49,7 +49,7 @@ public class KeymanagerLibSigner implements VCSigner { private String issuerPublicKeyURI; @Override - public VCResult attachSignature(String unSignedVC) { + public VCResult attachSignature(String unSignedVC, Map keyReferenceDetails) { // Can the below lines be done at Templating side itself ? VCResult VC = new VCResult<>(); JsonLDObject jsonLDObject = JsonLDObject.fromJson(unSignedVC); @@ -58,7 +58,7 @@ public VCResult attachSignature(String unSignedVC) { String validFrom; if (jsonLDObject.getJsonObject().containsKey(VCDM1Constants.ISSUANCE_DATE)) { validFrom = jsonLDObject.getJsonObject().get(VCDM1Constants.ISSUANCE_DATE).toString(); - } else if (jsonLDObject.getJsonObject().containsKey(VCDM2Constants.VALID_FROM)){ + } else if (jsonLDObject.getJsonObject().containsKey(VCDM2Constants.VALID_FROM)) { validFrom = jsonLDObject.getJsonObject().get(VCDM2Constants.VALID_FROM).toString(); } else { validFrom = ZonedDateTime.now(ZoneOffset.UTC) @@ -85,7 +85,7 @@ public VCResult attachSignature(String unSignedVC) { throw new CertifyException("Error during canonicalization"); } String vcEncodedHash = Base64.getUrlEncoder().encodeToString(vcHashBytes); - LdProof ldProofWithJWS = proofGenerator.generateProof(vcLdProof, vcEncodedHash); + LdProof ldProofWithJWS = proofGenerator.generateProof(vcLdProof, vcEncodedHash, keyReferenceDetails); ldProofWithJWS.addToJsonLDObject(jsonLDObject); VC.setCredential(jsonLDObject); return VC; diff --git a/certify-service/src/main/java/io/mosip/certify/services/spi/VCSigner.java b/certify-service/src/main/java/io/mosip/certify/vcsigners/VCSigner.java similarity index 55% rename from certify-service/src/main/java/io/mosip/certify/services/spi/VCSigner.java rename to certify-service/src/main/java/io/mosip/certify/vcsigners/VCSigner.java index 0866b39b..062c81a6 100644 --- a/certify-service/src/main/java/io/mosip/certify/services/spi/VCSigner.java +++ b/certify-service/src/main/java/io/mosip/certify/vcsigners/VCSigner.java @@ -1,11 +1,13 @@ -package io.mosip.certify.services.spi; +package io.mosip.certify.vcsigners; import io.mosip.certify.api.dto.VCResult; +import java.util.Map; + /** * VCSigner can sign any JSON-LD VC provided a vcHash & Signer inputs and * return a signed VCResult. */ public interface VCSigner { - VCResult attachSignature(String unSignedVC); + VCResult attachSignature(String unSignedVC, Map keyReferenceDetails); } diff --git a/certify-service/src/main/resources/application-local.properties b/certify-service/src/main/resources/application-local.properties index 4bad4459..ef8e55ef 100644 --- a/certify-service/src/main/resources/application-local.properties +++ b/certify-service/src/main/resources/application-local.properties @@ -10,7 +10,7 @@ mosip.certify.security.ignore-csrf-urls=**/actuator/**,/favicon.ico,**/error,\ **/issuance/**,**/system-info/** mosip.certify.security.ignore-auth-urls=/actuator/**,**/error,**/swagger-ui/**,\ - **/v3/api-docs/**, **/issuance/**,/system-info/**,/public/** + **/v3/api-docs/**, **/issuance/**,/system-info/**,/rendering-template/** ## ------------------------------------------ Discovery openid-configuration ------------------------------------------- @@ -19,7 +19,7 @@ mosipbox.public.url=https://localhost:8090 mosip.certify.authorization.url=http://localhost:8088 mosip.certify.discovery.issuer-id=${mosip.certify.domain.url}${server.servlet.path} mosip.certify.data-provider-plugin.issuer.vc-sign-algo=Ed25519Signature2018 -mosip.certify.issuer=CertifyIssuer +mosip.certify.plugin-mode=DataProvider ##--------------change this later--------------------------------- mosip.certify.supported.jwt-proof-alg={'RS256','PS256','ES256'} diff --git a/certify-service/src/test/java/io/mosip/certify/TestMockDataProviderPluginImpl.java b/certify-service/src/test/java/io/mosip/certify/TestMockDataProviderPluginImpl.java index 4fedc138..4d1fb03f 100644 --- a/certify-service/src/test/java/io/mosip/certify/TestMockDataProviderPluginImpl.java +++ b/certify-service/src/test/java/io/mosip/certify/TestMockDataProviderPluginImpl.java @@ -1,7 +1,7 @@ package io.mosip.certify; import io.mosip.certify.api.exception.DataProviderExchangeException; -import io.mosip.certify.services.spi.DataProviderPlugin; +import io.mosip.certify.api.spi.DataProviderPlugin; import lombok.extern.slf4j.Slf4j; import org.json.JSONObject; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/certify-service/src/test/java/io/mosip/certify/TestVCIssuanceServiceImpl.java b/certify-service/src/test/java/io/mosip/certify/TestVCIssuanceServiceImpl.java index 7a18a70f..71e44b0b 100644 --- a/certify-service/src/test/java/io/mosip/certify/TestVCIssuanceServiceImpl.java +++ b/certify-service/src/test/java/io/mosip/certify/TestVCIssuanceServiceImpl.java @@ -7,7 +7,7 @@ import java.util.Map; -@ConditionalOnProperty(value = "mosip.certify.issuer", havingValue = "TestIssuer") +@ConditionalOnProperty(value = "mosip.certify.plugin-mode", havingValue = "VCIssuance") public class TestVCIssuanceServiceImpl implements VCIssuanceService { @Override public CredentialResponse getCredential(CredentialRequest credentialRequest) { diff --git a/certify-service/src/test/java/io/mosip/certify/controller/RenderingTemplateControllerTest.java b/certify-service/src/test/java/io/mosip/certify/controller/RenderingTemplateControllerTest.java index af4457f7..879e089b 100644 --- a/certify-service/src/test/java/io/mosip/certify/controller/RenderingTemplateControllerTest.java +++ b/certify-service/src/test/java/io/mosip/certify/controller/RenderingTemplateControllerTest.java @@ -3,9 +3,8 @@ import io.mosip.certify.api.dto.RenderingTemplateDTO; import io.mosip.certify.core.constants.ErrorConstants; import io.mosip.certify.core.dto.ParsedAccessToken; -import io.mosip.certify.services.entity.RenderingTemplate; import io.mosip.certify.core.exception.RenderingTemplateException; -import io.mosip.certify.services.spi.RenderingTemplateService; +import io.mosip.certify.core.spi.RenderingTemplateService; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -49,7 +48,7 @@ public void getSvgTemplate_withValidId_thenPass() throws Exception { Mockito.when(renderingTemplateService.getSvgTemplate(Mockito.any())).thenReturn(renderingTemplateDTO); - mockMvc.perform(get("/public/rendering-template/fake-id")) + mockMvc.perform(get("/rendering-template/fake-id")) .andExpect(status().isOk()) .andExpect(content().string(renderingTemplateDTO.getTemplate())) .andExpect(content().contentType("image/svg+xml")) @@ -61,7 +60,7 @@ public void getSvgTemplate_withInValidId_thenFail() throws Exception { RenderingTemplateException templateException = new RenderingTemplateException(ErrorConstants.INVALID_TEMPLATE_ID); Mockito.when(renderingTemplateService.getSvgTemplate("fake-id")).thenThrow(templateException); - mockMvc.perform(get("/public/rendering-template/fake-id")) + mockMvc.perform(get("/rendering-template/fake-id")) .andExpect(status().isNotFound()); } } diff --git a/certify-service/src/test/java/io/mosip/certify/services/repository/RenderingTemplateRepositoryTest.java b/certify-service/src/test/java/io/mosip/certify/repository/RenderingCredentialTemplateRepositoryTest.java similarity index 92% rename from certify-service/src/test/java/io/mosip/certify/services/repository/RenderingTemplateRepositoryTest.java rename to certify-service/src/test/java/io/mosip/certify/repository/RenderingCredentialTemplateRepositoryTest.java index f461213c..81ae7fd1 100644 --- a/certify-service/src/test/java/io/mosip/certify/services/repository/RenderingTemplateRepositoryTest.java +++ b/certify-service/src/test/java/io/mosip/certify/repository/RenderingCredentialTemplateRepositoryTest.java @@ -1,6 +1,6 @@ -package io.mosip.certify.services.repository; +package io.mosip.certify.repository; -import io.mosip.certify.services.entity.RenderingTemplate; +import io.mosip.certify.entity.RenderingTemplate; import jakarta.validation.ConstraintViolationException; import org.junit.Assert; import org.junit.Test; @@ -12,11 +12,10 @@ import java.time.LocalDateTime; import java.util.Optional; -import java.util.UUID; @RunWith(SpringRunner.class) @DataJpaTest -public class RenderingTemplateRepositoryTest { +public class RenderingCredentialTemplateRepositoryTest { @Autowired private RenderingTemplateRepository svgRenderTemplateRepository; diff --git a/certify-service/src/test/java/io/mosip/certify/services/CertifyIssuanceServiceImplTest.java b/certify-service/src/test/java/io/mosip/certify/services/CertifyIssuanceServiceImplTest.java index 22fb83f3..945cd5f6 100644 --- a/certify-service/src/test/java/io/mosip/certify/services/CertifyIssuanceServiceImplTest.java +++ b/certify-service/src/test/java/io/mosip/certify/services/CertifyIssuanceServiceImplTest.java @@ -1,9 +1,8 @@ package io.mosip.certify.services; import io.mosip.certify.api.spi.AuditPlugin; -import io.mosip.certify.services.spi.DataProviderPlugin; -import io.mosip.certify.services.spi.VCFormatter; -import io.mosip.certify.services.spi.VCSigner; +import io.mosip.certify.api.spi.DataProviderPlugin; +import io.mosip.certify.vcformatters.VCFormatter; import io.mosip.certify.core.constants.ErrorConstants; import io.mosip.certify.core.constants.VCFormats; import io.mosip.certify.core.dto.CredentialDefinition; @@ -13,6 +12,7 @@ import io.mosip.certify.core.exception.NotAuthenticatedException; import io.mosip.certify.core.util.SecurityHelperService; import io.mosip.certify.proof.ProofValidatorFactory; +import io.mosip.certify.vcsigners.VCSigner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/certify-service/src/test/java/io/mosip/certify/services/RenderingTemplateServiceImplTest.java b/certify-service/src/test/java/io/mosip/certify/services/RenderingTemplateServiceImplTest.java index 83f3f3cc..62bff034 100644 --- a/certify-service/src/test/java/io/mosip/certify/services/RenderingTemplateServiceImplTest.java +++ b/certify-service/src/test/java/io/mosip/certify/services/RenderingTemplateServiceImplTest.java @@ -2,9 +2,9 @@ import io.mosip.certify.api.dto.RenderingTemplateDTO; import io.mosip.certify.core.constants.ErrorConstants; -import io.mosip.certify.services.entity.RenderingTemplate; import io.mosip.certify.core.exception.RenderingTemplateException; -import io.mosip.certify.services.repository.RenderingTemplateRepository; +import io.mosip.certify.entity.RenderingTemplate; +import io.mosip.certify.repository.RenderingTemplateRepository; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; diff --git a/certify-service/src/test/java/io/mosip/certify/services/validators/CredentialRequestValidatorTest.java b/certify-service/src/test/java/io/mosip/certify/validators/CredentialRequestValidatorTest.java similarity index 95% rename from certify-service/src/test/java/io/mosip/certify/services/validators/CredentialRequestValidatorTest.java rename to certify-service/src/test/java/io/mosip/certify/validators/CredentialRequestValidatorTest.java index d5f16bd9..6af40f8c 100644 --- a/certify-service/src/test/java/io/mosip/certify/services/validators/CredentialRequestValidatorTest.java +++ b/certify-service/src/test/java/io/mosip/certify/validators/CredentialRequestValidatorTest.java @@ -1,9 +1,8 @@ -package io.mosip.certify.services.validators; +package io.mosip.certify.validators; import io.mosip.certify.core.constants.VCFormats; import io.mosip.certify.core.dto.CredentialDefinition; import io.mosip.certify.core.dto.CredentialRequest; -import org.junit.Before; import org.junit.Test; import java.util.List; diff --git a/certify-service/src/test/java/io/mosip/certify/services/templating/VelocityTemplatingEngineImplTest.java b/certify-service/src/test/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImplTest.java similarity index 92% rename from certify-service/src/test/java/io/mosip/certify/services/templating/VelocityTemplatingEngineImplTest.java rename to certify-service/src/test/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImplTest.java index dfedfa1f..cb17f57a 100644 --- a/certify-service/src/test/java/io/mosip/certify/services/templating/VelocityTemplatingEngineImplTest.java +++ b/certify-service/src/test/java/io/mosip/certify/vcformatters/VelocityTemplatingEngineImplTest.java @@ -1,7 +1,7 @@ -package io.mosip.certify.services.templating; +package io.mosip.certify.vcformatters; -import io.mosip.certify.services.entity.CredentialTemplate; -import io.mosip.certify.services.repository.TemplateRepository; +import io.mosip.certify.entity.CredentialTemplate; +import io.mosip.certify.repository.CredentialTemplateRepository; import junit.framework.TestCase; import lombok.SneakyThrows; import net.javacrumbs.jsonunit.assertj.JsonAssertions; @@ -16,7 +16,6 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.stereotype.Service; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.client.RestTemplate; import java.util.*; @@ -29,7 +28,7 @@ public class VelocityTemplatingEngineImplTest extends TestCase { @InjectMocks private VelocityTemplatingEngineImpl formatter; @Mock - TemplateRepository templateRepository; + CredentialTemplateRepository credentialTemplateRepository; @SneakyThrows @Before @@ -38,7 +37,7 @@ public void setUp() { { "@context": [ "https://www.w3.org/2018/credentials/v1"] - "issuer": "${issuer}", + "issuer": "${_issuer}", "type": ["VerifiableCredential", "MockVerifiableCredential"], "issuanceDate": "${validFrom}", "expirationDate": "${validUntil}", @@ -63,7 +62,7 @@ public void setUp() { { "@context": [ "https://www.w3.org/ns/credentials/v2"], - "issuer": "${issuer}", + "issuer": "${_issuer}", "type": ["VerifiableCredential", "MockVerifiableCredential"], "validFrom": "${validFrom}", "validUntil": "${validUntil}", @@ -91,7 +90,7 @@ public void setUp() { "@context": [ "https://www.w3.org/2018/credentials/v1", "https://vharsh.github.io/DID/mock-context.json"], - "issuer": "${issuer}", + "issuer": "${_issuer}", "type": ["VerifiableCredential", "MockVerifiableCredential"], "issuanceDate": "${validFrom}", "expirationDate": "${validUntil}", @@ -115,9 +114,8 @@ public void setUp() { "https://vharsh.github.io/DID/mock-context.json,https://www.w3.org/2018/credentials/v1" ); //when(templateRepository.findByCredentialTypeAndContext("MockVerifiableCredential,VerifiableCredential", "https://schema.org,https://www.w3.org/2018/credentials/v1")).thenReturn(Optional.of(vc1)); - when(templateRepository.findByCredentialTypeAndContext("MockVerifiableCredential,VerifiableCredential", "https://example.org/Person.json,https://www.w3.org/ns/credentials/v2")).thenReturn(Optional.of(vc2)); + when(credentialTemplateRepository.findByCredentialTypeAndContext("MockVerifiableCredential,VerifiableCredential", "https://example.org/Person.json,https://www.w3.org/ns/credentials/v2")).thenReturn(Optional.of(vc2)); //when(templateRepository.findByCredentialTypeAndContext("MockVerifiableCredential,VerifiableCredential", "https://vharsh.github.io/DID/mock-context.json,https://www.w3.org/2018/credentials/v1")).thenReturn(Optional.of(vc3)); - ReflectionTestUtils.setField(formatter, "shouldHaveDates", true); formatter.initialize(); // engine = new VelocityEngine(); // engine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath"); diff --git a/certify-service/src/test/java/io/mosip/certify/services/KeymanagerLibSignerTest.java b/certify-service/src/test/java/io/mosip/certify/vcsigners/JsonLDVCSignerTest.java similarity index 81% rename from certify-service/src/test/java/io/mosip/certify/services/KeymanagerLibSignerTest.java rename to certify-service/src/test/java/io/mosip/certify/vcsigners/JsonLDVCSignerTest.java index f1096258..f77fb7ae 100644 --- a/certify-service/src/test/java/io/mosip/certify/services/KeymanagerLibSignerTest.java +++ b/certify-service/src/test/java/io/mosip/certify/vcsigners/JsonLDVCSignerTest.java @@ -1,10 +1,11 @@ -package io.mosip.certify.services; +package io.mosip.certify.vcsigners; import foundation.identity.jsonld.JsonLDObject; import info.weboftrust.ldsignatures.LdProof; import info.weboftrust.ldsignatures.canonicalizer.URDNA2015Canonicalizer; import io.mosip.certify.api.dto.VCResult; -import io.mosip.certify.services.proofgenerators.ProofGenerator; +import io.mosip.certify.core.constants.Constants; +import io.mosip.certify.proofgenerators.ProofGenerator; import io.mosip.kernel.signature.dto.JWTSignatureResponseDto; import org.junit.Assert; import org.junit.Before; @@ -18,16 +19,17 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +import java.util.HashMap; import java.util.Map; @RunWith(MockitoJUnitRunner.class) -public class KeymanagerLibSignerTest { +public class JsonLDVCSignerTest { @Mock SignatureService signatureService; @Mock ProofGenerator signProps; @InjectMocks - private KeymanagerLibSigner signer; + private JsonLDVCSigner jsonLDVCSigner; private static final String VC_1 = """ { "@context": [ @@ -62,7 +64,7 @@ public class KeymanagerLibSignerTest { @Before public void setup() { - ReflectionTestUtils.setField(signer, "issuerPublicKeyURI", "https://example.com/sample.pub.key.json/"); + ReflectionTestUtils.setField(jsonLDVCSigner, "issuerPublicKeyURI", "https://example.com/sample.pub.key.json/"); } @Test @@ -77,10 +79,12 @@ public void testAttachSignatureSuccess_VC2() { when(signProps.getName()).thenReturn("FakeSignature2018"); when(signProps.getCanonicalizer()).thenReturn(new URDNA2015Canonicalizer()); LdProof l = LdProof.builder().jws("fake-jws-proof").type("FakeSignature2018").proofPurpose("assertionMethod").build(); - when(signProps.generateProof(any(), any())).thenReturn(l); - + when(signProps.generateProof(any(), any(), any())).thenReturn(l); + Map defaultSettings = new HashMap<>(); + defaultSettings.put(Constants.APPLICATION_ID, "fake-application-id"); + defaultSettings.put(Constants.REFERENCE_ID, "fake-reference-id"); // invoke - VCResult vcResult = signer.attachSignature(templatedVC); + VCResult vcResult = jsonLDVCSigner.attachSignature(templatedVC, defaultSettings); // test assert vcResult != null; diff --git a/certify-service/src/test/resources/application-test.properties b/certify-service/src/test/resources/application-test.properties index 19a64724..2c7bb04a 100644 --- a/certify-service/src/test/resources/application-test.properties +++ b/certify-service/src/test/resources/application-test.properties @@ -4,11 +4,11 @@ ## ------------------------------------------- Integrations ------------------------------------------------------------ mosip.certify.security.ignore-auth-urls=/actuator/**,**/error,**/swagger-ui/**,\ - **/v3/api-docs/**, **/issuance/**,/system-info/**,**/public/** + **/v3/api-docs/**, **/issuance/**,/system-info/**,**/rendering-template/** mosip.certify.integration.scan-base-package=io.mosip.certify mosip.certify.integration.audit-plugin=TestAuditPlugin mosip.certify.integration.vci-plugin=TestVCIPluginImpl -mosip.certify.issuer=PluginIssuer +mosip.certify.plugin-mode=VCIssuance mosip.certify.data-provider-plugin.issuer.vc-sign-algo=Ed25519Signature2018 # mosip.certify.data-provider-plugin.issuer.vc-sign-algo:Ed25519Signature2018 for CertifyIssuer test diff --git a/db_upgrade_script/mosip_certify/sql/0.9.1_to_0.10.0_upgrade.sql b/db_upgrade_script/mosip_certify/sql/0.9.1_to_0.10.0_upgrade.sql index bb6eb650..4b80fb91 100644 --- a/db_upgrade_script/mosip_certify/sql/0.9.1_to_0.10.0_upgrade.sql +++ b/db_upgrade_script/mosip_certify/sql/0.9.1_to_0.10.0_upgrade.sql @@ -1,5 +1,6 @@ -INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_ED25519', 1095, 60, 'NA', true, 'mosipadmin', now()); +INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_VC_SIGN_RSA', 1095, 60, 'NA', true, 'mosipadmin', now()); +INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_VC_SIGN_ED25519', 1095, 60, 'NA', true, 'mosipadmin', now()); INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('BASE', 1095, 60, 'NA', true, 'mosipadmin', now()); CREATE TABLE rendering_template ( diff --git a/docker-compose/docker-compose-injistack/certify_init.sql b/docker-compose/docker-compose-injistack/certify_init.sql index 036ba542..59230463 100644 --- a/docker-compose/docker-compose-injistack/certify_init.sql +++ b/docker-compose/docker-compose-injistack/certify_init.sql @@ -81,57 +81,13 @@ CREATE TABLE certify.credential_template( CONSTRAINT pk_template PRIMARY KEY (context, credential_type) ); -INSERT INTO certify.credential_template (context, credential_type, template, cr_dtimes, upd_dtimes) VALUES ('https://vharsh.github.io/DID/mock-context.json,https://www.w3.org/2018/credentials/v1', 'MockVerifiableCredential,VerifiableCredential', '{ - "@context": [ - "https://www.w3.org/2018/credentials/v1", - "https://vharsh.github.io/DID/mock-context.json"], - "issuer": "${issuer}", - "type": ["VerifiableCredential", "MockVerifiableCredential"], - "issuanceDate": "${validFrom}", - "expirationDate": "${validUntil}", - "credentialSubject": { - "gender": ${gender}, - "postalCode": ${postalCode}, - "fullName": ${fullName}, - "dateOfBirth": "${dateOfBirth}", - "province": ${province}, - "phone": "${phone}", - "addressLine1": ${addressLine1}, - "region": ${region}, - "vcVer": "${vcVer}", - "UIN": ${UIN}, - "email": "${email}", - "face": "${face}" - } -}', '2024-10-22 17:08:17.826851', NULL); -INSERT INTO certify.credential_template (context, credential_type, template, cr_dtimes, upd_dtimes) VALUES ('https://vharsh.github.io/DID/mock-context.json,https://www.w3.org/ns/credentials/v2', 'MockVerifiableCredential,VerifiableCredential', '{ - "@context": [ - "https://www.w3.org/ns/credentials/v2", "https://vharsh.github.io/DID/mock-context.json"], - "issuer": "${issuer}", - "type": ["VerifiableCredential", "MockVerifiableCredential"], - "validFrom": "${validFrom}", - "validUntil": "${validUntil}", - "credentialSubject": { - "gender": ${gender}, - "postalCode": ${postalCode}, - "fullName": ${fullName}, - "dateOfBirth": "${dateOfBirth}", - "province": ${province}, - "phone": "${phone}", - "addressLine1": ${addressLine1}, - "region": ${region}, - "vcVer": "${vcVer}", - "UIN": ${UIN}, - "email": "${email}", - "face": "${face}" - } -}', '2024-10-22 17:08:17.826851', NULL); INSERT INTO certify.credential_template (context, credential_type, template, cr_dtimes, upd_dtimes) VALUES ('https://www.w3.org/2018/credentials/v1', 'FarmerCredential,VerifiableCredential', '{ "@context": [ "https://www.w3.org/2018/credentials/v1", - "https://piyush7034.github.io/my-files/farmer.json" + "https://piyush7034.github.io/my-files/farmer.json", + "https://w3id.org/security/suites/ed25519-2020/v1" ], - "issuer": "${issuer}", + "issuer": "${_issuer}", "type": [ "VerifiableCredential", "FarmerCredential" @@ -157,6 +113,37 @@ INSERT INTO certify.credential_template (context, credential_type, template, cr_ } ', '2024-10-24 12:32:38.065994', NULL); +INSERT INTO certify.template_data (context, credential_type, template, cr_dtimes, upd_dtimes) VALUES ('https://www.w3.org/ns/credentials/v2', 'FarmerCredential,VerifiableCredential', '{ + "@context": [ + "https://www.w3.org/ns/credentials/v2", + "https://vharsh.github.io/DID/farmer.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "issuer": "${_issuer}", + "type": [ + "VerifiableCredential", + "FarmerCredential" + ], + "validFrom": "${validFrom}", + "validUntil": "${validUntil}", + "credentialSubject": { + "name": "${name}", + "dateOfBirth": "${dateOfBirth}", + "highestEducation": "${highestEducation}", + "maritalStatus": "${maritalStatus}", + "typeOfHouse": "${typeOfHouse}", + "numberOfDependents": "${numberOfDependents}", + "phoneNumber": "${phoneNumber}", + "works": "${works}", + "landArea": "${landArea}", + "landOwnershipType": "${landOwnershipType}", + "primaryCropType": "${primaryCropType}", + "secondaryCropType": "${secondaryCropType}", + "face": "${face}", + "farmerID": "${farmerID}" + } +} +', '2024-10-24 12:32:38.065994', NULL); INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('ROOT', 2920, 1125, 'NA', true, 'mosipadmin', now()); INSERT INTO certify.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_SERVICE', 1095, 60, 'NA', true, 'mosipadmin', now()); diff --git a/docker-compose/docker-compose-injistack/config/certify-csvdp-farmer.properties b/docker-compose/docker-compose-injistack/config/certify-csvdp-farmer.properties index 6fee5b35..038028fd 100644 --- a/docker-compose/docker-compose-injistack/config/certify-csvdp-farmer.properties +++ b/docker-compose/docker-compose-injistack/config/certify-csvdp-farmer.properties @@ -9,20 +9,22 @@ mosip.certify.mock.authenticator.get-identity-url=http://mock-identity-system:80 mosip.certify.cache.security.algorithm-name=AES/ECB/PKCS5Padding mosip.certify.cache.secure.individual-id=false mosip.certify.cache.store.individual-id=true -mosip.certify.rendering-templates=insurance-svg-template.json +# TODO: Onboard secrets for local build +mosip.certify.mock.vciplugin.issuer.key-cert="dummy-issuer-cert" +mosip.certify.mock.vciplugin.ca.key-cert=dummy mosip.certify.identifier=http://localhost:8090 mosip.certify.data-provider-plugin.issuer-uri=did:web:vharsh.github.io:DID:harsh mosip.certify.data-provider-plugin.issuer-public-key-uri=did:web:vharsh.github.io:DID:harsh#key-0 -mosip.certify.issuer=CertifyIssuer +mosip.certify.plugin-mode=DataProvider mosip.certify.data-provider-plugin.id-field-prefix-uri=https://mosip.io/credential/ mosip.certify.integration.data-provider-plugin=MockCSVDataProviderPlugin mosip.certify.data-provider-plugin.issuer.vc-sign-algo=Ed25519Signature2020 ## CSV specific config mosip.certify.mock.data-provider.csv.identifier-column=id mosip.certify.mock.data-provider.csv.data-columns=id,fullName,mobileNumber,dateOfBirth,gender,state,district,villageOrTown,postalCode,landArea,landOwnershipType,primaryCropType,secondaryCropType,face,farmerID -mosip.certify.mock.data-provider.csv-registry-uri=https://raw.githubusercontent.com/mosip/inji-config/refs/heads/develop/farmer_registry.csv +mosip.certify.mock.data-provider.csv-registry-uri=/home/mosip/config/farmer_identity_data.csv mosip.certify.data-provider-plugin.rendering-template-id= mosip.certify.key-values={\ 'vd12' : {\ @@ -97,4 +99,4 @@ mosip.certify.key-values={\ 'background_image': { 'uri': 'https://sunbird.org/images/sunbird-logo-new.png' }, \ 'text_color': '#7C4616'}},\ 'order' : {'farmerID','fullName','mobileNumber','dateOfBirth','gender','state','district','villageOrTown','postalCode','landArea','landOwnershipType','primaryCropType','secondaryCropType'}\ - }}}} \ No newline at end of file + }}}} diff --git a/docker-compose/docker-compose-injistack/config/certify-default.properties b/docker-compose/docker-compose-injistack/config/certify-default.properties index 31166d40..14a42806 100644 --- a/docker-compose/docker-compose-injistack/config/certify-default.properties +++ b/docker-compose/docker-compose-injistack/config/certify-default.properties @@ -48,7 +48,7 @@ mosip.certify.authorization.url=https://esignet-mock.dev1.mosip.net ##--------------change this later--------------------------------- mosip.certify.supported.jwt-proof-alg={'RS256','PS256'} -mosip.certify.issuer=CertifyIssuer +mosip.certify.plugin-mode=DataProvider ##----- These are reference to the oauth resource server providing jwk----------------------------------## diff --git a/docker-compose/docker-compose-injistack/docker-compose.yaml b/docker-compose/docker-compose-injistack/docker-compose.yaml index 92575af0..3a442eff 100644 --- a/docker-compose/docker-compose-injistack/docker-compose.yaml +++ b/docker-compose/docker-compose-injistack/docker-compose.yaml @@ -14,7 +14,7 @@ services: - "5433:5432" certify: - image: mosipdev/inji-certify:develop + image: mosipqa/inji-certify:release-0.10.x user: root ports: - 8090:8090 @@ -30,6 +30,8 @@ services: - ./config/certify-csvdp-farmer.properties:/home/mosip/config/certify-csvdp-farmer.properties - ./data/CERTIFY_PKCS12:/home/mosip/CERTIFY_PKCS12 - ./loader_path/certify/:/home/mosip/additional_jars/ + # modify the below file to change the identity fields in the VC + - ./config/farmer_identity_data.csv:/home/mosip/config/farmer_identity_data.csv networks: - network depends_on: @@ -39,7 +41,7 @@ services: container_name: nginx image: nginx:alpine ports: - - '8080:80' + - '80:80' volumes: - ./config/mimoto-issuers-config.json:/config/server/mimoto-issuers-config.json - ./config/mimoto-trusted-verifiers.json:/config/server/mimoto-trusted-verifiers.json @@ -52,7 +54,7 @@ services: mimoto-service: container_name: 'Mimoto-Service' - image: 'mosipid/mimoto:0.14.0' + image: mosipid/mimoto:0.14.0 user: root ports: - '8099:8099'