Skip to content

Commit

Permalink
Added VC bean
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishch22 committed Oct 20, 2023
1 parent 3da754a commit b4b33b8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,5 +32,25 @@ public ParsedAccessToken parsedAccessToken() {
return new ParsedAccessToken();
}


}
@Bean("esignet-service")
public VCIssuancePlugin getVCIssuancePlugin() {
return new VCIssuancePlugin() {
@Override
public VCResult<JsonLDObject> getVerifiableCredentialWithLinkedDataProof(VCRequestDto vcRequestDto, String holderId, Map<String, Object> identityDetails) {
VCResult<JsonLDObject> vcResult = new VCResult<>();
vcResult.setCredential(new JsonLDObject());
vcResult.setFormat("ldp_vc");
return vcResult;
}

@Override
public VCResult<String> getVerifiableCredential(VCRequestDto vcRequestDto, String holderId, Map<String, Object> identityDetails) {
VCResult<String> vcResult_jwt = new VCResult<>();
vcResult_jwt.setCredential("jwt");
vcResult_jwt.setFormat("jwt_vc_json-ld");
return vcResult_jwt;
}
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -54,6 +55,7 @@ public class VCIssuanceServiceImpl implements VCIssuanceService {
@Autowired
private ParsedAccessToken parsedAccessToken;

@Qualifier("esignet-service")
@Autowired
private VCIssuancePlugin vcIssuancePlugin;

Expand Down

0 comments on commit b4b33b8

Please sign in to comment.