Skip to content

Commit

Permalink
merged release -1.2.0 (mosip#68)
Browse files Browse the repository at this point in the history
* Created 1.2.0-rc2 (mosip#23)

Co-authored-by: Monobikash Das <M1045447@mindtree.com>

* MOSIP-15420: Upgraded swagger2.0 to openapi3.0 for packet manager service (mosip#31)

Resolved merge conflict

* Added logger and fixed test cases (mosip#32)

Co-authored-by: Monobikash Das <M1045447@mindtree.com>

* MOSIP-15420: Generated openapi.json for packet manager service (mosip#34)

* MOSIP-15420: Upgraded swagger2.0 to openapi3.0 for packet manager service

Resolved merge conflict

* MOSIP-15420: Generated openapi.json for packet manager service

Resolved merge conflicts

* MOSIP-18453 : improved usage of caching (mosip#36)

Co-authored-by: Monobikash Das <M1045447@mindtree.com>

* Added sonar_analysis

* MOSIP-18450 : added exception for objects not available in minio (mosip#37)

* MOSIP-18450 : added exception for objects not available in minio

* Added sonar_analysis

* MOSIP-18910 : fixed refNumber issue in DocumentDto

* MOSIP-18450 : added exception for objects not available in minio

* MOSIP-18910 : fixed refNumber issue in DocumentDto

* initial change

* MOSIP-18450 : added exception for objects not available in minio

* MOSIP-18910 : fixed refNumber issue in DocumentDto

* initial change

* MOSIP-18793 :Added afterburner + fixes

Co-authored-by: Monobikash Das <M1045447@mindtree.com>
Co-authored-by: Rakshitha650 <76676196+Rakshitha650@users.noreply.github.com>
Co-authored-by: Mandeep Dhiman <46880392+mandeepdhiman123@users.noreply.github.com>
Co-authored-by: Admin <Admin@MONOBIKASH>

* Mosip:15286 Changed openapi.json name.

* updated the Sonar_analysis code and removed the Dskiptests

* updated the Sonar_analysis code and removed the Dskiptests

* added gpg keys

* changes for real bio

* Merged with 1.2.0-rc2

* changes for real bio

* Auth role issue fixed (mosip#46)

* MOR-147 : multithreading issue for create packet api (mosip#52)

Co-authored-by: Admin <Admin@MONOBIKASH>

* Added documentation

* Update README.md

* Update README.md

* [MOSIP-19587] Cleanup.

* Update configuration.md

* Update configuration.md

* Update configuration.md

* Updated readme and sonar fix

* Update README.md

* [MOSIP-19883] updated worflows

* [MOSIP-19883] updated worflows

* Update push_trigger.yml

* Updated Pom versions for release changes

Co-authored-by: Monobikash Das <M1045447@mindtree.com>
Co-authored-by: kameshsr <47484458+kameshsr@users.noreply.github.com>
Co-authored-by: Rakshitha650 <76676196+Rakshitha650@users.noreply.github.com>
Co-authored-by: Mandeep Dhiman <46880392+mandeepdhiman123@users.noreply.github.com>
Co-authored-by: Admin <Admin@MONOBIKASH>
Co-authored-by: Rakshith650 <rakshitham38@gmail.com>
Co-authored-by: Sasikumar Ganesan <gsasikumar@gmail.com>
Co-authored-by: Puneet Joshi <48353425+pjoshi751@users.noreply.github.com>
Co-authored-by: Puneet Joshi <puneet@mosip.io>
Co-authored-by: ckm007 <chandrakeshavmishra@gmail.com>
Co-authored-by: ckm007 <ckm007@users.noreply.github.com>
Signed-off-by: Sowmya Ujjappa Banakar <sowmya.61022006@ltimindtree.com>
  • Loading branch information
12 people authored and Sowmya Ujjappa Banakar committed Mar 6, 2024
1 parent d1d274d commit a48fbad
Show file tree
Hide file tree
Showing 241 changed files with 187 additions and 11,527 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/push_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- master
- 1.*
- develop
- '!release-branch'
- release-1*

jobs:
build:
Expand Down Expand Up @@ -75,6 +77,7 @@ jobs:
if: failure() # Pick up events even if the job fails or is canceled.

publish_to_nexus:
if: "!contains(github.ref, 'master')"
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -185,7 +188,11 @@ jobs:
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo "push version ${{steps.getPomVersion.outputs.info}}"
VERSION=$BRANCH_NAME
if [[ $BRANCH_NAME == master ]]; then
VERSION=latest
else
VERSION=$BRANCH_NAME
fi
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $SERVICE_NAME $IMAGE_ID:$VERSION
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/release_changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release/pre-release Preparation.

on:
workflow_dispatch:
inputs:
message:
description: 'Triggered for release or pe-release'
required: false
default: 'Release Preparation'
releaseTags:
description: 'tag to update'
required: true
snapshotTags:
description: 'tag to be replaced'
required: true
base:
description: 'base branch for PR'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup branch and env
run: |
# Strip git ref prefix from version
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV
- 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"

- name: Updating the Release URL in POM
run: |
cd .github/workflows
sed -i 's/OSSRH_SNAPSHOT_URL/RELEASE_URL/g' push_trigger.yml
- name: Updating libs-snapshot-local to libs-release local for artifactory URL's.
run: find . -type f -name "*Dockerfile" -print0 | xargs -0 sed -i "s/libs-snapshot-local/libs-release-local/g"

- name: removing -DskipTests
run: find . -type f -name "*push_trigger.yml" -print0 | xargs -0 sed -i "s/"-DskipTests"//g"

# - name: removing --Dgpg.skip
# run: find . -type f -name "*push_trigger.yml" -print0 | xargs -0 sed -i "s/"-Dgpg.skip"//g"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ACTION_PAT }}
commit-message: Updated Pom versions for release changes
title: Release changes
body: Automated PR for ${{ github.event.inputs.releaseTags }} release.
branch: release-branch
delete-branch: true
base: ${{ github.event.inputs.base }}
66 changes: 5 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,8 @@
[![Build Status](https://travis-ci.com/mosip/commons.svg?branch=master)](https://travis-ci.com/mosip/commons)
[![Maven Package upon a push](https://github.com/mosip/packet-manager/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0)](https://github.com/mosip/packet-manager/actions/workflows/push_trigger.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.2.0&project=mosip_packet-manager&id=mosip_packet-manager2&metric=alert_status)](https://sonarcloud.io/dashboard?branch=master&id=mosip_packet-manager)

[![Join the chat at https://gitter.im/mosip-community/Commons-Kernel](https://badges.gitter.im/mosip-community/Commons-Kernel.svg)](https://gitter.im/mosip-community/Commons-Kernel?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

# mosip-platform
This repository contains the source code of the Modular Open Source Identity Platform. To know more about MOSIP, its architecture, external integrations, releases, etc., please check the [Platform Documentation](https://github.com/mosip/mosip-docs/wiki)

### Introduction
MOSIP consists of the following modules -
1. `Kernel` - The Kernel module provides a bedrock to build and run services by providing several significant necessary technical functions. It contains common functionalities which are used by more than one module.
2. `Pre-Registration` - Pre-Registration module enables individuals to book appointments in a registration centre, by providing basic demographic details.
3. `Registration` - Registration module provides a desktop application for Registration Officers/Supervisors to register an individual in MOSIP, by capturing their demographic and biometric details.
4. `Registration Processor` - Registration Processor validates and processes an individual's data received from the registration module, and eventually generates a UIN (Unique Identification Number) for the individual.
5. `ID Repository` - The ID Repository module acts as a repository of individual's data along with UIN mapped.
6. `ID Authentication` - ID Authentication module enables a Partner to authenticate an individual.

### Build
The following commands should be run in the parent project to build all the modules -
`mvn clean install`
The above command can be used to build individual modules when run in their respective folders

### Deploy
The following command should be executed to run any service locally in specific profile and local configurations -
`java -Dspring.profiles.active=<profile> -jar <jar-name>.jar`

The following command should be executed to run any service locally in specific profile and `remote` configurations -
`java -Dspring.profiles.active=<profile> -Dspring.cloud.config.uri=<config-url> -Dspring.cloud.config.label=<config-label> -jar <jar-name>.jar`

The following command should be executed to run a docker image -
`docker run -it -p <host-port>:<container-port> -e active_profile_env={profile} -e spring_config_label_env= {branch} -e spring_config_url_env={config_server_url} <docker-registry-IP:docker-registry-port/<dcker-image>`

#### Run as Developer
For running services in a native environment developer has to run some core components
[Instruction to follow for running core components](./StartKernelCoreComponents_instructions.md)
### Configurations
All the configurations used by the codebase in `mosip-platform` is present in [mosip-config](https://github.com/mosip/mosip-config) repository.

### Functional Test-cases
Functional tests run against the codebase in `mosip-platform` is present in [mosip-functional-tests](https://github.com/mosip/mosip-functional-tests) repository.

### Documentation
Relevant documents to get started with MOSIP can be found in [mosip-docs](https://github.com/mosip/mosip-docs) repository.
In order to get started, please refer to the [Getting-Started](https://github.com/mosip/mosip-docs/wiki/Getting-Started) guide.

### Infra
Automated scripts to build and deploy MOSIP modules are present in [mosip-infra](https://github.com/mosip/mosip-infra) repository.


---

### Contribute
You can contribute to MOSIP!

We want to engage constructively with the community. If you find a **vulnerability** or issue, please file a bug with the respective repository. We welcome pull requests with fixes too. Please see the [Contributor Guide](https://github.com/mosip/mosip-docs/wiki/Contributor-Guide) on how to file bugs, contribute code, and more.

### License
This project is licensed under the terms of [Mozilla Public License 2.0](https://github.com/mosip/mosip-platform/blob/master/LICENSE)

### Communication
Join the [developer mailing list](https://groups.io/g/mosip-dev)

## Comprehensive review
During comprehensive review, inline documentation of kernel will be changed. Look for Jira issue MOS-31009
# Packet Manager

## About
* Its used by "Registration Client" and "Resident Service" to create packets.
* Its used by "Registration Processor" to read packet.
5 changes: 5 additions & 0 deletions commons-packet/commons-packet-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Commons Packet Manager

# About
* This is used as a jar dependency by regclient and resident service to create packet.
* This is also used by [commons-packet-service](../commons-packet-service) to read and write packet into object store.
22 changes: 11 additions & 11 deletions commons-packet/commons-packet-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<name>commons-packet-manager</name>
<description>Mosip commons project </description>
<url>https://github.com/mosip/commons</url>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.0.1-SNAPSHOT</version>
<properties>
<!-- maven -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -30,23 +30,23 @@
<spring-cloud-config.version>2.0.0.RELEASE</spring-cloud-config.version>
<h2.version>1.4.197</h2.version>
<jackson.datatype.version>2.9.8</jackson.datatype.version>
<kernel.keygenerator.bouncycastle.version>1.2.0-SNAPSHOT</kernel.keygenerator.bouncycastle.version>
<kernel.keygenerator.bouncycastle.version>1.2.0.1-SNAPSHOT</kernel.keygenerator.bouncycastle.version>
<swagger.version>2.9.2</swagger.version>
<powermock.beta.version>2.0.7</powermock.beta.version>
<junit.version>4.13.1</junit.version>
<hazelcast.kubernetes.version>1.3.1</hazelcast.kubernetes.version>

<kernel-keymanager-service.version>1.2.0-SNAPSHOT</kernel-keymanager-service.version>
<kernel-idobjectvalidator.version>1.2.0-SNAPSHOT</kernel-idobjectvalidator.version>
<kernel.core.version>1.2.0-SNAPSHOT</kernel.core.version>
<kernel.biometrics.api.version>1.2.0-SNAPSHOT</kernel.biometrics.api.version>
<kernel.cbeffutil.api.version>1.2.0-SNAPSHOT</kernel.cbeffutil.api.version>
<kernel.crypto-jce.version>1.2.0-SNAPSHOT</kernel.crypto-jce.version>
<kernel.auth.adaptor.version>1.2.0-SNAPSHOT</kernel.auth.adaptor.version>
<kernel-dataaccess-hibernate.version>1.2.0-SNAPSHOT</kernel-dataaccess-hibernate.version>
<kernel.logger.logback.version>1.2.0-SNAPSHOT</kernel.logger.logback.version>
<kernel-idobjectvalidator.version>1.2.0.1-SNAPSHOT</kernel-idobjectvalidator.version>
<kernel.core.version>1.2.0.1-SNAPSHOT</kernel.core.version>
<kernel.biometrics.api.version>1.2.0.1-SNAPSHOT</kernel.biometrics.api.version>
<kernel.cbeffutil.api.version>1.2.0.1-SNAPSHOT</kernel.cbeffutil.api.version>
<kernel.crypto-jce.version>1.2.0.1-SNAPSHOT</kernel.crypto-jce.version>
<kernel.auth.adaptor.version>1.2.0.1-SNAPSHOT</kernel.auth.adaptor.version>
<kernel-dataaccess-hibernate.version>1.2.0.1-SNAPSHOT</kernel-dataaccess-hibernate.version>
<kernel.logger.logback.version>1.2.0.1-SNAPSHOT</kernel.logger.logback.version>
<spring.boot.co>2.0.2.RELEASE</spring.boot.co>
<khazana.version>1.2.0-SNAPSHOT</khazana.version>
<khazana.version>1.2.0.1-SNAPSHOT</khazana.version>
<sonar.coverage.exclusions>**/constants/**,**/config/**,**/audit/**,**/util/**,**/dto/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*BootApplication.java,**/*VertxApplication.java,**/cbeffutil/**,**/*Utils.java,**/*Validator.java,**/*Helper.java,**/verticle/**,**/VidWriter.java/**,**/masterdata/utils/**,**/spi/**,**/core/http/**,"**/LocationServiceImpl.java","**/RegistrationCenterMachineServiceImpl.java","**/RegistrationCenterServiceImpl.java","**/pridgenerator/**","**/idgenerator/prid","**/proxy/**","**/cryptosignature/**"</sonar.coverage.exclusions>
<sonar.cpd.exclusions>**/dto/**,**/entity/**,**/config/**</sonar.cpd.exclusions>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public String addAudit(String description, String eventId,
id,
"AuditLogRequestBuilder:: AuditLogEntry::exit");

return responseWrapper.getBody();
return responseWrapper != null ? responseWrapper.getBody() : null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import io.mosip.commons.packet.dto.Document;
import io.mosip.commons.packet.util.PacketManagerLogger;
import io.mosip.kernel.biometrics.entities.BiometricRecord;
import io.mosip.kernel.core.exception.ExceptionUtils;
import io.mosip.kernel.core.logger.spi.Logger;
import io.mosip.kernel.core.util.DateUtils;
import lombok.Data;
import org.json.JSONArray;
Expand All @@ -18,6 +21,8 @@

@Data
public class RegistrationPacket {

private static final Logger LOGGER = PacketManagerLogger.getLogger(RegistrationPacket.class);

private String registrationId;
private double idSchemaVersion;
Expand Down Expand Up @@ -97,7 +102,7 @@ else if (json instanceof JSONArray) {
} else
finalMap.putIfAbsent(fieldName, value);
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("Exception while setting field " + ExceptionUtils.getStackTrace(e));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -66,8 +65,8 @@ public class OnlinePacketCryptoServiceImpl implements IPacketCryptoService {
private boolean isPrependThumbprintEnabled;

@Autowired
private ApplicationContext applicationContext;
private RestTemplate restTemplate = null;
@Qualifier("selfTokenRestTemplate")
private RestTemplate restTemplate;

@Autowired
private ObjectMapper mapper;
Expand Down Expand Up @@ -98,7 +97,7 @@ public byte[] sign(byte[] packet) {
.parse(DateUtils.getUTCCurrentDateTimeString(DATETIME_PATTERN), format);
request.setRequesttime(localdatetime);
HttpEntity<RequestWrapper<TpmSignRequestDto>> httpEntity = new HttpEntity<>(request);
ResponseEntity<String> response = getRestTemplate().exchange(keymanagerCsSignUrl, HttpMethod.POST, httpEntity,
ResponseEntity<String> response = restTemplate.exchange(keymanagerCsSignUrl, HttpMethod.POST, httpEntity,
String.class);
LinkedHashMap responseMap = (LinkedHashMap) mapper.readValue(response.getBody(), LinkedHashMap.class).get("response");
if (responseMap != null && responseMap.size() > 0)
Expand Down Expand Up @@ -144,7 +143,7 @@ public byte[] encrypt(String refId, byte[] packet) {
request.setVersion(APPLICATION_VERSION);
HttpEntity<RequestWrapper<CryptomanagerRequestDto>> httpEntity = new HttpEntity<>(request);

ResponseEntity<String> response = getRestTemplate().exchange(cryptomanagerEncryptUrl, HttpMethod.POST, httpEntity, String.class);
ResponseEntity<String> response = restTemplate.exchange(cryptomanagerEncryptUrl, HttpMethod.POST, httpEntity, String.class);
CryptomanagerResponseDto responseObject = mapper.readValue(response.getBody(), CryptomanagerResponseDto.class);
if (responseObject != null &&
responseObject.getErrors() != null && !responseObject.getErrors().isEmpty()) {
Expand Down Expand Up @@ -214,7 +213,7 @@ public byte[] decrypt(String refId, byte[] packet) {
request.setVersion(APPLICATION_VERSION);
HttpEntity<RequestWrapper<CryptomanagerRequestDto>> httpEntity = new HttpEntity<>(request);

ResponseEntity<String> response = getRestTemplate().exchange(cryptomanagerDecryptUrl, HttpMethod.POST, httpEntity, String.class);
ResponseEntity<String> response = restTemplate.exchange(cryptomanagerDecryptUrl, HttpMethod.POST, httpEntity, String.class);

CryptomanagerResponseDto responseObject = mapper.readValue(response.getBody(), CryptomanagerResponseDto.class);

Expand Down Expand Up @@ -271,7 +270,7 @@ public boolean verify(String refId, byte[] packet, byte[] signature) {
.parse(DateUtils.getUTCCurrentDateTimeString(DATETIME_PATTERN), format);
request.setRequesttime(localdatetime);
HttpEntity<RequestWrapper<TpmSignVerifyRequestDto>> httpEntity = new HttpEntity<>(request);
ResponseEntity<String> response = getRestTemplate().exchange(keymanagerCsverifysignUrl, HttpMethod.POST, httpEntity,
ResponseEntity<String> response = restTemplate.exchange(keymanagerCsverifysignUrl, HttpMethod.POST, httpEntity,
String.class);
LinkedHashMap responseMap = (LinkedHashMap) mapper.readValue(response.getBody(), LinkedHashMap.class).get("response");//.get("signature");
if (responseMap != null && responseMap.size() > 0) {
Expand All @@ -298,7 +297,7 @@ public boolean verify(String refId, byte[] packet, byte[] signature) {

private String getPublicKey(String refId) throws IOException {
String machineId = refId.split("_")[1];
ResponseEntity<String> response = getRestTemplate().exchange(syncdataGetTpmKeyUrl+machineId, HttpMethod.GET, null,
ResponseEntity<String> response = restTemplate.exchange(syncdataGetTpmKeyUrl+machineId, HttpMethod.GET, null,
String.class);
LinkedHashMap responseMap = (LinkedHashMap) mapper.readValue(response.getBody(), LinkedHashMap.class).get("response");//.get("signature");
if (responseMap != null && responseMap.size() > 0)
Expand All @@ -309,12 +308,4 @@ private String getPublicKey(String refId) throws IOException {
throw new SignatureException();
}
}

private RestTemplate getRestTemplate() {
if (this.restTemplate == null) {
this.restTemplate = (RestTemplate)this.applicationContext.getBean("selfTokenRestTemplate");
}

return this.restTemplate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.Map;

import io.mosip.commons.packet.facade.PacketReader;
import io.mosip.kernel.core.exception.ExceptionUtils;
import io.mosip.kernel.core.util.HMACUtils2;
import org.apache.commons.io.IOUtils;
import org.json.JSONArray;
Expand Down Expand Up @@ -193,7 +194,7 @@ private byte[] generateHash(List<FieldValueArray> hashSequence, Map<String, Inpu
valuebyte = IOUtils.toByteArray(fileStream);
outputStream.write(valuebyte);
} catch (IOException e) {
e.printStackTrace();
LOGGER.error("Exception while generating hash " + ExceptionUtils.getStackTrace(e));
}
});
}
Expand Down
Loading

0 comments on commit a48fbad

Please sign in to comment.