Skip to content
Open
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 .github/workflows/push_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:

- name: Publish the maven package
run: |
mvn deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.OSSRH_SNAPSHOT_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml
mvn deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.RELEASE_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GPG_TTY: $(tty)
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV

- name: update Branch name in badges
run: |
sed -i 's/branch=.*)]/branch=${{ env.BRANCH_NAME }}\)]/g' README.md
sed -i 's/branch=.*\&/branch=${{ env.BRANCH_NAME }}\&/g' README.md

- name: Mannualy changing the pom versions
run: find . -type f -name "*pom.xml" -print0 | xargs -0 sed -i "s/${{ github.event.inputs.snapshotTags }}/${{ github.event.inputs.releaseTags }}/g"

Expand All @@ -48,7 +53,7 @@ jobs:
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ACTION_PAT }}
commit-message: Updated Pom versions for release changes
commit-message: Release Bot Pre-release changes
title: Release changes
body: Automated PR for ${{ github.event.inputs.releaseTags }} release.
branch: release-branch
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tagging of repos

env:
tag: v1.2.3

on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to be published'
required: true
default: 'v1.2.3'
type: string
body:
description: 'Release body message'
required: true
default: 'Changes in this Release'
type: string
pre-release:
description: 'Pre-release? True/False'
required: true
default: False
type: string

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.tag }}
body: |
${{ github.event.inputs.body }}
draft: false
prerelease: ${{fromJSON(github.event.inputs.pre-release)}}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Maven Package upon a push](https://github.com/mosip/print/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0)](https://github.com/mosip/print/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.2.0&project=mosip_admin-services&id=mosip_admin-services&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.2.0&id=mosip_admin-services)
[![Maven Package upon a push](https://github.com/mosip/print/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/print/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.2.0.1&project=mosip_admin-services&id=mosip_admin-services&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.2.0.1&id=mosip_admin-services)
# Print Service

## Overview
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>io.mosip.print</groupId>
<artifactId>print</artifactId>
<version>1.2.0.1-SNAPSHOT</version>
<version>1.2.0.1-B1</version>
<name>print</name>

<properties>
Expand Down Expand Up @@ -39,7 +39,7 @@
<sonar.cpd.exclusions>**/dto/**,**/config/**,**/api/**</sonar.cpd.exclusions>
<io.micrometer.prometheus.version>1.4.2</io.micrometer.prometheus.version>
<gson.version>2.8.4</gson.version>
<kernel.websub.version>1.2.0.1-SNAPSHOT</kernel.websub.version>
<kernel.websub.version>1.2.0.1-B1</kernel.websub.version>
<itextcore.version>7.1.0</itextcore.version>
<itexthtml2pdf.version>2.0.0</itexthtml2pdf.version>
<itext.version>5.5.13</itext.version>
Expand All @@ -56,7 +56,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.2.RELEASE</version>
<version>2.5.12</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
Expand Down Expand Up @@ -230,9 +230,9 @@
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>info.weboftrust</groupId>
<artifactId>ld-signatures-java</artifactId>
<version>0.8.0</version>
<groupId>io.mosip.vercred</groupId>
<artifactId>vcverifier</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/io/mosip/print/PrintPDFApplication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.mosip.print;

import io.mosip.vercred.CredentialsVerifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
Expand Down Expand Up @@ -29,6 +30,11 @@ public CbeffUtil getCbeffUtil() {
return new CbeffImpl();
}

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

@Bean
public ThreadPoolTaskScheduler taskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
Expand Down
38 changes: 20 additions & 18 deletions src/main/java/io/mosip/print/service/impl/PrintServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import io.mosip.print.exception.*;
import io.mosip.vercred.CredentialsVerifier;
import io.mosip.vercred.exception.ProofDocumentNotFoundException;
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;
import org.joda.time.DateTime;
import org.json.simple.JSONArray;
Expand All @@ -56,20 +62,6 @@
import io.mosip.print.dto.CryptoWithPinResponseDto;
import io.mosip.print.dto.DataShare;
import io.mosip.print.dto.JsonValue;
import io.mosip.print.exception.ApiNotAccessibleException;
import io.mosip.print.exception.ApisResourceAccessException;
import io.mosip.print.exception.CryptoManagerException;
import io.mosip.print.exception.DataShareException;
import io.mosip.print.exception.ExceptionUtils;
import io.mosip.print.exception.IdRepoAppException;
import io.mosip.print.exception.IdentityNotFoundException;
import io.mosip.print.exception.PDFGeneratorException;
import io.mosip.print.exception.PDFSignatureException;
import io.mosip.print.exception.ParsingException;
import io.mosip.print.exception.PlatformErrorMessages;
import io.mosip.print.exception.QrcodeGenerationException;
import io.mosip.print.exception.TemplateProcessingFailureException;
import io.mosip.print.exception.UINNotFoundInDatabase;
import io.mosip.print.logger.LogDescription;
import io.mosip.print.logger.PrintLogger;
import io.mosip.print.model.CredentialStatusEvent;
Expand All @@ -81,7 +73,6 @@
import io.mosip.print.spi.QrCodeGenerator;
import io.mosip.print.util.AuditLogRequestBuilder;
import io.mosip.print.util.CbeffToBiometricUtil;
import io.mosip.print.util.CredentialsVerifier;
import io.mosip.print.util.CryptoCoreUtil;
import io.mosip.print.util.CryptoUtil;
import io.mosip.print.util.DataShareUtil;
Expand Down Expand Up @@ -201,6 +192,7 @@ public class PrintServiceImpl implements PrintService{
public boolean generateCard(EventModel eventModel) {
String credential = null;
boolean isPrinted = false;
boolean verified=false;
try {
if (eventModel.getEvent().getDataShareUri() == null || eventModel.getEvent().getDataShareUri().isEmpty()) {
credential = eventModel.getEvent().getData().get("credential").toString();
Expand All @@ -211,12 +203,22 @@ public boolean generateCard(EventModel eventModel) {
}
String ecryptionPin = eventModel.getEvent().getData().get("protectionKey").toString();
String decodedCredential = cryptoCoreUtil.decrypt(credential);
printLogger.debug("vc is printed security valuation.... : {}",decodedCredential);
if (verifyCredentialsFlag){
printLogger.info("Configured received credentials to be verified. Flag {}", verifyCredentialsFlag);
boolean verified = credentialsVerifier.verifyCredentials(decodedCredential);
if (!verified) {
try {
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 | ProofTypeNotFoundException e){
printLogger.error("Proof document is not available in the received credentials." +
" Id: {}, Transaction Id: {}", eventModel.getEvent().getId(), eventModel.getEvent().getTransactionId());
}catch (UnknownException | PubicKeyNotFoundException e){
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());
" Id: {}, Transaction Id: {}", eventModel.getEvent().getId(), eventModel.getEvent().getTransactionId());
return false;
}
}
Expand Down
147 changes: 0 additions & 147 deletions src/main/java/io/mosip/print/util/CredentialsVerifier.java

This file was deleted.