Skip to content

Commit

Permalink
Mosip-38063 Merge develop changes to release-1.3.x (#1373)
Browse files Browse the repository at this point in the history
* MOSIP-37921 Fixed subscription issue in migrated resident service. (#1365)

* MOSIP-35611 Fixed subscription issue in resident service

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Fixed websub issue

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Fixed websub issue

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Fixed websub issue

Signed-off-by: kameshsr <[email protected]>

* Corrected version

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Comment postconstruct for testing

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Corrected task sceduler

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Fixed websub issue

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Made thread pool values configurable

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Fixed websub issue

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Fixed startup issue

Signed-off-by: kameshsr <[email protected]>

* MOSIP-35611 Fixed startup issue

Signed-off-by: kameshsr <[email protected]>

* Mosip-35611 Fixed websub issue

Signed-off-by: kameshsr <[email protected]>

---------

Signed-off-by: kameshsr <[email protected]>

* MOSIP-37357 corrected readme (#1356)

* MOSIP-37357 corrected readme

Signed-off-by: kameshsr <[email protected]>

* MOSIP-37357 Corrected java version

Signed-off-by: kameshsr <[email protected]>

* MOSIP-37357 corrected readme

Signed-off-by: kameshsr <[email protected]>

* MOSIP-37357 Corrected Readme

Signed-off-by: kameshsr <[email protected]>

* MOSIP-37357 Corrected Readme

Signed-off-by: kameshsr <[email protected]>

* MOSIP-37357 Corrected Readme

Signed-off-by: kameshsr <[email protected]>

---------

Signed-off-by: kameshsr <[email protected]>

* MOSIP-38063 Merge develop code to release

Signed-off-by: kameshsr <[email protected]>

* MOSIP-38063 Corrected readme

Signed-off-by: kameshsr <[email protected]>

* Corrected docker file

Signed-off-by: kameshsr <[email protected]>

* MOSIP-38063 Corrected version

Signed-off-by: kameshsr <[email protected]>

* MOSIP-38063 Corrected version

Signed-off-by: kameshsr <[email protected]>

---------

Signed-off-by: kameshsr <[email protected]>
  • Loading branch information
kameshsr authored Dec 10, 2024
1 parent bb318fc commit 0e6b4ef
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 90 deletions.
97 changes: 57 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@

[![Maven Package upon a push](https://github.com/mosip/resident-services/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0)](https://github.com/mosip/resident-services/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_resident-services&id=mosip_resident-services&branch=release-1.2.0&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_resident-services&branch=release-1.2.0)
[![Maven Package upon a push](https://github.com/mosip/resident-services/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.3.0)](https://github.com/mosip/resident-services/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_resident-services&id=mosip_resident-services&branch=release-1.3.0&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_resident-services&branch=release-1.3.0)

# Resident Services
This repository contains the source code and design documents for MOSIP Resident Service. For an overview please refer [here](https://docs.mosip.io/1.2.0/modules/resident-services). This module exposes API endpoints for Resident UI (refer [Resident UI github repo](https://github.com/mosip/resident-ui/blob/master/README.md)).

## Overview
This repository contains the source code and design documents for MOSIP Resident Service. For an overview please refer [here](https://docs.mosip.io/1.2.0/modules/resident-services). This module exposes API endpoints for Resident UI (refer [Resident UI GitHub repo](https://github.com/mosip/resident-ui/blob/master/README.md)).

## Database
See [DB guide](db_scripts/README.md)

## Config-Server
To run Resident services, run [Config Server](https://docs.mosip.io/1.2.0/modules/module-configuration#config-server)
See [DB Scripts](db_scripts)

## Build & run (for developers)
The project requires JDK 1.21.
The project requires JDK 21.0.3
and mvn version - 3.9.6
1. Build and install:
```
$ cd resident-service
$ mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip=true
$ mvn install -Dgpg.skip=true
```
2. Build Docker for a service:
```
$ cd <service folder>
$ docker build -f Dockerfile
```
### Remove the version-specific suffix (PostgreSQL95Dialect) from the Hibernate dialect configuration
```
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
```
This is for better compatibility with future PostgreSQL versions.
### Configure ANT Path Matcher for Spring Boot 3.x compatibility.
```
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
```
This is to maintain compatibility with existing ANT-style path patterns.
### Add Below Config in [resident-default.properties](https://github.com/mosip/mosip-config/blob/develop/resident-default.properties)
### Add Below Config in [resident-default.properties](https://github.com/mosip/mosip-config/blob/master/resident-default.properties)
```
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
## Keymanager service
Expand All @@ -35,53 +50,55 @@ mosip.kernel.keymanager.hsm.config-path=/config/softhsm-application.conf

mosip.kernel.keymanager.hsm.keystore-pass=${softhsm.kernel.security.pin}

# For Spring-boot 3.x we need to specify the ANT Path Matcher for using the existing ANT path patterns.
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

# Spring boot 3.x onwards we need to specify the below property to unmask values in actuator env url
management.endpoint.env.show-values=ALWAYS

resident.template.purpose.success.AUTHENTICATION_REQUEST=mosip.event.type.AUTHENTICATION_REQUEST
resident.template.purpose.failure.AUTHENTICATION_REQUEST=mosip.event.type.AUTHENTICATION_REQUEST
```
### Update below config in [resident-default.properties](https://github.com/mosip/mosip-config/blob/develop/resident-default.properties)
### Update below config in [resident-default.properties](https://github.com/mosip/mosip-config/blob/master/resident-default.properties)
### The exclusion list of URL patterns that should not be part of authentication and authorization
```
mosip.service.end-points=/**/req/otp,/**/proxy/**,/**/validate-otp,/**/channel/verification-status/**,/**/req/credential/**,/**/req/card/*,/**/req/auth-history,/**/rid/check-status,/**/req/auth-lock,/**/req/auth-unlock,/**/req/update-uin,/**/req/print-uin,/**/req/euin,/**/credential/types,/**/req/policy/**,/**/aid/status,/**/individualId/otp,/**/mock/**,/**/callback/**,/**/download-card,/**/download/registration-centers-list/**,/**/download/supporting-documents/**,/**/vid/policy,/**/vid,/vid/**,/**/download/nearestRegistrationcenters/**,/**/authorize/admin/validateToken,/**/logout/user,/**/aid-stage/**
```
1. Build Docker for a service:
```
$ cd <service folder>
$ docker build -f Dockerfile
```
## Configuration
[resident-default.properties](https://github.com/mosip/mosip-config/blob/master/resident-default.properties)
### Add Below jars in a class-path to run a services
```
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter</artifactId>
<version>${kernel.auth.adaptor.version}</version>
</dependency>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-ref-idobjectvalidator</artifactId>
<version>${kernel-ref-idobjectvalidator.version}</version>
</dependency>
```
[application-default.properties](https://github.com/mosip/mosip-config/blob/master/application-default.properties)
defined here.
## Deploy
To deploy Commons services on Kubernetes cluster using Dockers refer to [Sandbox Deployment](https://docs.mosip.io/1.2.0/deployment/sandbox-deployment).
## Config-Server
To run Resident services, run [Config Server](https://docs.mosip.io/1.2.0/modules/module-configuration#config-server)
## Configuration
[resident-default.properties](https://github.com/mosip/mosip-config/blob/develop/resident-default.properties)
## Default context, path, port
Refer to [bootstrap properties](resident/resident-service/src/main/resources/bootstrap.properties)
[application-default.properties](https://github.com/mosip/mosip-config/blob/develop/application-default.properties)
defined here.
## Deployment in K8 cluster with other MOSIP services:
### Pre-requisites
* Set KUBECONFIG variable to point to existing K8 cluster kubeconfig file:
```
export KUBECONFIG=~/.kube/<k8s-cluster.config>
```
### Install
```
$ cd deploy
$ ./install.sh
```
### Delete
```
$ cd deploy
$ ./delete.sh
```
### Restart
```
$ cd deploy
$ ./restart.sh
```
## Test
Automated functional tests available in [Functional Tests repo](https://github.com/mosip/mosip-functional-tests).
Automated functional tests available in [Functional Tests repo](api-test).
## APIs
API documentation is available [here](https://mosip.github.io/documentation/).
Expand Down
2 changes: 1 addition & 1 deletion api-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mosipdev/openjdk-21-jre:latest
FROM mosipid/openjdk-21-jre:21.0.4

ARG SOURCE
ARG COMMIT_HASH
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\echo 'Upgrade Queries not required for transition from $CURRENT_VERSION to $UPGRADE_VERSION'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\echo 'Upgrade Queries not required for transition from $CURRENT_VERSION to $UPGRADE_VERSION'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\echo 'Upgrade Queries not required for transition from $CURRENT_VERSION to $UPGRADE_VERSION'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\echo 'Upgrade Queries not required for transition from $CURRENT_VERSION to $UPGRADE_VERSION'
6 changes: 3 additions & 3 deletions resident/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

<groupId>io.mosip.resident</groupId>
<artifactId>resident-parent</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>resident</name>
<description>Parent project of MOSIP Resident</description>
<url>https://github.com/mosip/resident-services</url>

<licenses>
<license>
<name>MPL 2.0</name>
Expand Down Expand Up @@ -79,6 +78,7 @@
**/constant/**,**/config/**,**/httpfilter/**,**/cache/**,**/dto/**,**/entity/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*BootApplication.java,**/*VertxApplication.java,**/cbeffutil/**,**/mock/**,**/OrderCard*,**/testrig/**
</sonar.coverage.exclusions>
<sonar.cpd.exclusions>**/dto/**,**/entity/**,**/config/**</sonar.cpd.exclusions>
<kernel-bom.version>1.3.0-beta.1</kernel-bom.version>
</properties>

<modules>
Expand All @@ -89,7 +89,7 @@
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-bom</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>${kernel-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
37 changes: 20 additions & 17 deletions resident/resident-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,30 @@
<parent>
<groupId>io.mosip.resident</groupId>
<artifactId>resident-parent</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>
<artifactId>resident-service</artifactId>
<name>resident-service</name>
<version>1.2.1-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<properties>
<commons.packet.manager.version>1.2.1-SNAPSHOT</commons.packet.manager.version>
<kernel.core.version>1.2.1-SNAPSHOT</kernel.core.version>
<kernel.virusscanner.clamav.version>1.2.1-SNAPSHOT</kernel.virusscanner.clamav.version>
<kernel-keymanager-service.version>1.2.1-SNAPSHOT</kernel-keymanager-service.version>
<kernel.authcodeflowproxy.api.version>1.2.1-SNAPSHOT</kernel.authcodeflowproxy.api.version>
<kernel.parent.version>1.2.1-SNAPSHOT</kernel.parent.version>
<commons.packet.manager.version>1.3.0-SNAPSHOT</commons.packet.manager.version>
<kernel.core.version>1.3.0-beta.1</kernel.core.version>
<kernel.virusscanner.clamav.version>1.3.0-SNAPSHOT</kernel.virusscanner.clamav.version>
<kernel-keymanager-service.version>1.3.0-beta.1</kernel-keymanager-service.version>
<kernel.authcodeflowproxy.api.version>1.3.0-beta.1</kernel.authcodeflowproxy.api.version>
<kernel.parent.version>1.3.0-beta.1</kernel.parent.version>
<kernel-cbeffutil-api.version>${kernel.parent.version}</kernel-cbeffutil-api.version>
<kernel.khazana.version>1.2.1-SNAPSHOT</kernel.khazana.version>
<kernel-openid-bridge-api.version>1.2.1-SNAPSHOT</kernel-openid-bridge-api.version>
<kernel.khazana.version>1.3.0-beta.1</kernel.khazana.version>
<kernel-openid-bridge-api.version>1.3.0-beta.1</kernel-openid-bridge-api.version>
<maven.jacoco.plugin.version>0.8.11</maven.jacoco.plugin.version>
<kernel.idobjectvalidator.version>1.2.1-SNAPSHOT</kernel.idobjectvalidator.version>
<pre-registration-application-service.version>1.2.1-SNAPSHOT</pre-registration-application-service.version>
<kernel.idobjectvalidator.version>1.3.0-beta.1</kernel.idobjectvalidator.version>
<pre-registration-application-service.version>1.3.0-SNAPSHOT</pre-registration-application-service.version>
<jacoco.maven.plugin.version>0.8.11</jacoco.maven.plugin.version>
<id-repository-core.version>1.2.1-SNAPSHOT</id-repository-core.version>

<kernel-websubclient-api.version>1.3.0-beta.1</kernel-websubclient-api.version>
<kernel-pdfgenerator-itext.version>1.3.0-beta.1</kernel-pdfgenerator-itext.version>
<kernel-ref-idobjectvalidato.version>1.3.0-SNAPSHOT</kernel-ref-idobjectvalidato.version>
<kernel-auth-adpater.version>1.3.0-beta.1</kernel-auth-adpater.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -254,7 +257,7 @@
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-websubclient-api</artifactId>
<version>${project.version}</version>
<version>${kernel-websubclient-api.version}</version>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
Expand Down Expand Up @@ -299,7 +302,7 @@
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-pdfgenerator-itext</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>${kernel-pdfgenerator-itext.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
Expand All @@ -319,12 +322,12 @@
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>${kernel-auth-adpater.version}</version>
</dependency>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-ref-idobjectvalidator</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>${kernel-ref-idobjectvalidato.version}</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import io.mosip.kernel.pdfgenerator.itext.impl.PDFGeneratorImpl;
import io.mosip.kernel.templatemanager.velocity.builder.TemplateManagerBuilderImpl;
import io.mosip.kernel.transliteration.icu4j.impl.TransliterationImpl;
import io.mosip.kernel.websub.api.client.PublisherClientImpl;
import io.mosip.kernel.websub.api.client.SubscriberClientImpl;
import io.mosip.kernel.websub.api.config.WebSubClientConfig;
import io.mosip.kernel.websub.api.config.publisher.RestTemplateHelper;
import io.mosip.kernel.websub.api.config.publisher.WebSubPublisherClientConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -37,14 +37,16 @@
"io.mosip.kernel.virusscanner.*",
"io.mosip.commons.khazana.*",
"io.mosip.idrepository.core.util.*",
"io.mosip.kernel.authcodeflowproxy.*"}
"io.mosip.kernel.authcodeflowproxy.*",
"io.mosip.kernel.websub.api.config"}
)
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
@Import({TokenIDGenerator.class, ValidateTokenUtil.class, CbeffImpl.class, TransliterationService.class, TransliterationServiceUtil.class
, PDFGeneratorImpl.class, UinValidatorImpl.class, VidValidatorImpl.class, RidValidatorImpl.class, TemplateManagerBuilderImpl.class,
SubscriberClientImpl.class, RestTemplateHelper.class, TransliterationImpl.class, PublisherClientImpl.class, IdObjectValidatorConfig.class
, RestTemplate.class, KeyStoreImpl.class})
RestTemplateHelper.class, TransliterationImpl.class, IdObjectValidatorConfig.class
, RestTemplate.class, KeyStoreImpl.class, WebSubPublisherClientConfig.class,
WebSubClientConfig.class,})
public class ResidentBootApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.Properties;

import io.mosip.kernel.websub.api.config.WebSubClientConfig;
import jakarta.servlet.Filter;

import org.apache.commons.collections.CollectionUtils;
Expand All @@ -22,6 +23,7 @@
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
Expand Down Expand Up @@ -49,6 +51,7 @@
@Configuration
@EnableScheduling
@EnableAsync
@Import(WebSubClientConfig.class)
public class Config {
private String defaultEncoding = StandardCharsets.UTF_8.name();
/** The resource loader. */
Expand All @@ -68,7 +71,15 @@ public class Config {

@Value("${" + ResidentConstants.RESIDENT_REST_TEMPLATE_METRICS_INTERCEPTOR_FILTER_ENABLED + ":false}")
private boolean isResidentMetricsInterceptorFilterEnabled;


@Value("${task.scheduler.pool-size:10}")
private int poolSize;

@Value("${task.scheduler.await-termination-seconds:30}")
private int awaitTerminationSeconds;

@Value("${task.scheduler.wait-for-tasks-to-complete-on-shutdown:true}")
private boolean waitForTasksToCompleteOnShutdown;

@Autowired(required = false)
private RestTemplateLoggingInterceptor restTemplateLoggingInterceptor;
Expand Down Expand Up @@ -172,8 +183,10 @@ private void addInterceptors(RestTemplate restTemplate) {
@Bean
public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(5);
threadPoolTaskScheduler.setPoolSize(poolSize);
threadPoolTaskScheduler.setThreadNamePrefix("ThreadPoolTaskScheduler");
threadPoolTaskScheduler.setWaitForTasksToCompleteOnShutdown(waitForTasksToCompleteOnShutdown);
threadPoolTaskScheduler.setAwaitTerminationSeconds(awaitTerminationSeconds);
return threadPoolTaskScheduler;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

import java.io.IOException;

/**
@author Kamesh Shekhar Prasad
*/

@Component
public class TrailingSlashRedirectFilter implements Filter {

Expand All @@ -16,9 +20,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha

HttpServletRequest httpRequest = (HttpServletRequest) request;
String path = httpRequest.getRequestURI();

// For other types of requests, handle the trailing slash redirection
if (path.endsWith("/")) {
if (path.endsWith("/") && !path.endsWith("status/")) {
String newPath = path.substring(0, path.length() - 1);
HttpServletRequest newRequest = new CustomHttpServletRequestWrapper(httpRequest, newPath);
chain.doFilter(newRequest, response);
Expand Down
Loading

0 comments on commit 0e6b4ef

Please sign in to comment.