Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-32453 #248

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
<dependency>
<groupId>io.mosip.vercred</groupId>
<artifactId>vcverifier</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/mosip/print/PrintPDFApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public CbeffUtil getCbeffUtil() {
return new CbeffImpl();
}

@Bean
public CredentialsVerifier credentialsVerifier() {
return new CredentialsVerifier();
}

@Bean
public ThreadPoolTaskScheduler taskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

import io.mosip.vercred.CredentialsVerifier;
import io.mosip.vercred.exception.ProofDocumentNotFoundException;
import io.mosip.vercred.exception.ProofTypeNotSupportedException;
import io.mosip.vercred.exception.ProofTypeNotFoundException;
import io.mosip.vercred.exception.PubicKeyNotFoundException;
import io.mosip.vercred.exception.UnknownException;
import org.apache.commons.codec.binary.Base64;
Expand Down Expand Up @@ -175,7 +175,8 @@ public class PrintServiceImpl implements PrintService {
@Autowired
private Environment env;

private CredentialsVerifier credentialsVerifier= new CredentialsVerifier();
@Autowired
private CredentialsVerifier credentialsVerifier;

@Value("${mosip.datashare.partner.id}")
private String partnerId;
Expand Down Expand Up @@ -238,13 +239,13 @@ private boolean hasPrintCredentialVerified(EventModel eventModel, String decoded
if (verifyCredentialsFlag) {
printLogger.info("Configured received credentials to be verified. Flag {}", verifyCredentialsFlag);
try {
boolean verified = credentialsVerifier.verifyCredentials(decodedCredential);
boolean verified = credentialsVerifier.verifyPrintCredentials(decodedCredential);
if (!verified) {
printLogger.error("Received Credentials failed in verifiable credential verify method. So, the credentials will not be printed." +
" Id: {}, Transaction Id: {}", eventModel.getEvent().getId(), eventModel.getEvent().getTransactionId());
return false;
}
} catch (ProofDocumentNotFoundException | ProofTypeNotSupportedException e) {
} catch (ProofDocumentNotFoundException | ProofTypeNotFoundException e) {
printLogger.error("Proof document is not available in the received credentials." +
" Id: {}, Transaction Id: {}", eventModel.getEvent().getId(), eventModel.getEvent().getTransactionId());
return false;
Expand Down Expand Up @@ -391,7 +392,8 @@ private Map<String, byte[]> getDocuments(String credential, String credentialTyp
description.setMessage(PlatformErrorMessages.PRT_PRT_PDF_GENERATION_FAILED.getMessage());
description.setCode(PlatformErrorMessages.PRT_PRT_PDF_GENERATION_FAILED.getCode());
printLogger.error(ex.getMessage() ,ex);

throw new PDFGeneratorException(PDFGeneratorExceptionCodeConstant.PDF_EXCEPTION.getErrorCode(),
ex.getMessage() ,ex);
} finally {
String eventId = "";
String eventName = "";
Expand Down
Loading