From b4b33b88f0c9f39c09afc8e66baec0365bb32baa Mon Sep 17 00:00:00 2001 From: Manish Choudhary Date: Fri, 20 Oct 2023 15:56:16 +0530 Subject: [PATCH] Added VC bean --- .../mosip/esignet/vci/config/VCIConfig.java | 32 +++++++++++++++++-- .../vci/services/VCIssuanceServiceImpl.java | 2 ++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/vci-service-impl/src/main/java/io/mosip/esignet/vci/config/VCIConfig.java b/vci-service-impl/src/main/java/io/mosip/esignet/vci/config/VCIConfig.java index 08f22d5c5..e8a989867 100644 --- a/vci-service-impl/src/main/java/io/mosip/esignet/vci/config/VCIConfig.java +++ b/vci-service-impl/src/main/java/io/mosip/esignet/vci/config/VCIConfig.java @@ -5,13 +5,21 @@ */ package io.mosip.esignet.vci.config; +import io.mosip.esignet.api.dto.VCRequestDto; +import io.mosip.esignet.api.dto.VCResult; +import io.mosip.esignet.api.spi.VCIssuancePlugin; import io.mosip.esignet.core.dto.vci.ParsedAccessToken; import lombok.extern.slf4j.Slf4j; + +import java.util.Map; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.context.annotation.RequestScope; +import foundation.identity.jsonld.JsonLDObject; + @Slf4j @Configuration @@ -24,5 +32,25 @@ public ParsedAccessToken parsedAccessToken() { return new ParsedAccessToken(); } - -} \ No newline at end of file + @Bean("esignet-service") + public VCIssuancePlugin getVCIssuancePlugin() { + return new VCIssuancePlugin() { + @Override + public VCResult getVerifiableCredentialWithLinkedDataProof(VCRequestDto vcRequestDto, String holderId, Map identityDetails) { + VCResult vcResult = new VCResult<>(); + vcResult.setCredential(new JsonLDObject()); + vcResult.setFormat("ldp_vc"); + return vcResult; + } + + @Override + public VCResult getVerifiableCredential(VCRequestDto vcRequestDto, String holderId, Map identityDetails) { + VCResult vcResult_jwt = new VCResult<>(); + vcResult_jwt.setCredential("jwt"); + vcResult_jwt.setFormat("jwt_vc_json-ld"); + return vcResult_jwt; + } + }; + } + +} diff --git a/vci-service-impl/src/main/java/io/mosip/esignet/vci/services/VCIssuanceServiceImpl.java b/vci-service-impl/src/main/java/io/mosip/esignet/vci/services/VCIssuanceServiceImpl.java index b2a8af90d..8fbf97823 100644 --- a/vci-service-impl/src/main/java/io/mosip/esignet/vci/services/VCIssuanceServiceImpl.java +++ b/vci-service-impl/src/main/java/io/mosip/esignet/vci/services/VCIssuanceServiceImpl.java @@ -28,6 +28,7 @@ import io.mosip.esignet.vci.pop.ProofValidatorFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.oauth2.jwt.JwtClaimNames; import org.springframework.stereotype.Service; @@ -54,6 +55,7 @@ public class VCIssuanceServiceImpl implements VCIssuanceService { @Autowired private ParsedAccessToken parsedAccessToken; + @Qualifier("esignet-service") @Autowired private VCIssuancePlugin vcIssuancePlugin;