From 2d1654c68fd05aedcf8d33b9599a97b518ee756e Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 25 Jun 2024 11:29:11 +0530 Subject: [PATCH 01/19] MOSIP-34016 Migrate to java 21 Signed-off-by: kameshsr --- authentication-demo-service/pom.xml | 45 ++++++++++--------- .../test/AuthRequestControllerTest.java | 4 +- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/authentication-demo-service/pom.xml b/authentication-demo-service/pom.xml index 70dc0a99c67..87ad98f02e2 100644 --- a/authentication-demo-service/pom.xml +++ b/authentication-demo-service/pom.xml @@ -4,7 +4,7 @@ io.mosip.testrig.authentication.demo - 1.2.0.1-SNAPSHOT + 1.2.1-java21-SNAPSHOT authentication-demo-service authentication-demo-service Parent project of MOSIP functional tests @@ -65,15 +65,15 @@ 2.0.2.RELEASE 2.0.0.RELEASE - 11 - 11 + 21 + 21 3.8.0 3.0.1 2.9.2 0.8.2 true - 1.2.0.1-SNAPSHOT + 1.2.1-java21-SNAPSHOT @@ -82,12 +82,10 @@ org.springframework.boot spring-boot-starter-web - ${spring.boot.version} org.springframework.boot spring-boot-starter-test - ${spring.boot.version} io.springfox @@ -102,7 +100,6 @@ commons-io commons-io - 2.6 javax.ws.rs @@ -112,13 +109,12 @@ org.glassfish.jersey.core jersey-common - 2.22.2 test io.mosip.authentication authentication-core - 1.2.0.1-B3 + 1.2.1-java21-SNAPSHOT commons-codec @@ -129,19 +125,17 @@ commons-fileupload commons-fileupload - 1.4 org.mockito mockito-core - 2.23.4 io.mosip.kernel kernel-core - 1.2.0.1-SNAPSHOT + 1.2.1-java21-SNAPSHOT org.springframework.boot @@ -164,13 +158,11 @@ org.springframework.boot spring-boot-starter-actuator - 2.0.2.RELEASE org.apache.httpcomponents httpclient - 4.5.7 commons-codec @@ -193,7 +185,6 @@ org.apache.commons commons-lang3 - 3.3.2 org.tensorflow @@ -221,22 +212,19 @@ commons-codec commons-codec - 1.11 io.mosip.kernel kernel-templatemanager-velocity - 1.2.0.1-SNAPSHOT + 1.2.1-java21-SNAPSHOT org.springframework.cloud spring-cloud-starter-config - ${spring-cloud-config.version} org.postgresql postgresql - 42.2.1 com.github.jai-imageio @@ -251,7 +239,7 @@ io.mosip.kernel kernel-keymanager-service - 1.2.0.1-SNAPSHOT + 1.2.1-java21-SNAPSHOT lib @@ -267,7 +255,22 @@ dom4j 1.6.1 + + org.junit.vintage + junit-vintage-engine + + + + + io.mosip.kernel + kernel-bom + 1.2.1-java21-SNAPSHOT + pom + import + + + @@ -288,7 +291,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} true ZIP @@ -341,7 +343,6 @@ org.jacoco jacoco-maven-plugin - ${maven.jacoco.version} **/constant/** diff --git a/authentication-demo-service/src/test/java/io/mosip/testrig/authentication/demo/service/test/AuthRequestControllerTest.java b/authentication-demo-service/src/test/java/io/mosip/testrig/authentication/demo/service/test/AuthRequestControllerTest.java index 42ce241d5c6..2de51cb1a65 100644 --- a/authentication-demo-service/src/test/java/io/mosip/testrig/authentication/demo/service/test/AuthRequestControllerTest.java +++ b/authentication-demo-service/src/test/java/io/mosip/testrig/authentication/demo/service/test/AuthRequestControllerTest.java @@ -16,8 +16,8 @@ import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; import org.jose4j.lang.JoseException; import org.json.JSONException; From 0e774d636b051ca1cd7b177fa6ac69e969ccaeef Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 25 Jun 2024 11:43:27 +0530 Subject: [PATCH 02/19] Migrate to java 21 Signed-off-by: kameshsr --- .../authentication/demo/service/config/BioProviderConfig.java | 2 +- .../authentication/demo/service/config/SwaggerConfig.java | 2 +- .../demo/service/controller/AuthRequestController.java | 2 +- .../demo/service/dto/ValidateSignRequestDto.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/BioProviderConfig.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/BioProviderConfig.java index dee59495702..a6aa41e1548 100644 --- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/BioProviderConfig.java +++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/BioProviderConfig.java @@ -1,6 +1,6 @@ package io.mosip.testrig.authentication.demo.service.config; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java index 374b4fab00d..4875ee300c8 100644 --- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java +++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Set; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/AuthRequestController.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/AuthRequestController.java index a45c3a29f27..dfbd0720a65 100644 --- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/AuthRequestController.java +++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/controller/AuthRequestController.java @@ -41,7 +41,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/dto/ValidateSignRequestDto.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/dto/ValidateSignRequestDto.java index 7dfa5ad2b22..b6bc1a22af6 100644 --- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/dto/ValidateSignRequestDto.java +++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/dto/ValidateSignRequestDto.java @@ -2,8 +2,8 @@ import java.time.LocalDateTime; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Data; From 4eae1699cbdf6960d2d26c2e738d7edded92182a Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 25 Jun 2024 16:13:27 +0530 Subject: [PATCH 03/19] Fixed startup issue Signed-off-by: kameshsr --- .../demo/service/PartnerDemoApplication.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/PartnerDemoApplication.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/PartnerDemoApplication.java index 173a7d3a2a8..7cc2558cad6 100644 --- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/PartnerDemoApplication.java +++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/PartnerDemoApplication.java @@ -1,5 +1,9 @@ package io.mosip.testrig.authentication.demo.service; +import io.mosip.kernel.templatemanager.velocity.builder.TemplateManagerBuilderImpl; +import io.mosip.kernel.websub.api.client.PublisherClientImpl; +import io.mosip.kernel.websub.api.client.SubscriberClientImpl; +import io.mosip.kernel.websub.api.config.publisher.RestTemplateHelper; import org.apache.velocity.app.VelocityEngine; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -15,7 +19,8 @@ * @author Dinesh Karuppiah */ @SpringBootApplication -@Import(value = { TemplateManagerImpl.class, VelocityEngine.class, SwaggerConfig.class, CryptoCore.class}) +@Import(value = { TemplateManagerImpl.class, VelocityEngine.class, SwaggerConfig.class, CryptoCore.class, TemplateManagerBuilderImpl.class, + PublisherClientImpl.class, RestTemplateHelper.class, SubscriberClientImpl.class}) public class PartnerDemoApplication { /** From 6b0645e322186dbe5b7ffaf3f682a70c46263127 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 25 Jun 2024 16:47:49 +0530 Subject: [PATCH 04/19] Upgrade to openapi Signed-off-by: kameshsr --- authentication-demo-service/pom.xml | 15 +- .../service/config/OpenApiProperties.java | 45 ++++++ .../demo/service/config/SwaggerConfig.java | 141 +++++------------- .../src/main/resources/bootstrap.properties | 12 ++ 4 files changed, 101 insertions(+), 112 deletions(-) create mode 100644 authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/OpenApiProperties.java diff --git a/authentication-demo-service/pom.xml b/authentication-demo-service/pom.xml index 87ad98f02e2..0f7a54a8cf0 100644 --- a/authentication-demo-service/pom.xml +++ b/authentication-demo-service/pom.xml @@ -87,16 +87,6 @@ org.springframework.boot spring-boot-starter-test - - io.springfox - springfox-swagger-ui - 2.9.2 - - - io.springfox - springfox-swagger2 - 2.9.2 - commons-io commons-io @@ -259,6 +249,11 @@ org.junit.vintage junit-vintage-engine + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.5.0 + diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/OpenApiProperties.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/OpenApiProperties.java new file mode 100644 index 00000000000..ef2b2b95526 --- /dev/null +++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/OpenApiProperties.java @@ -0,0 +1,45 @@ +package io.mosip.testrig.authentication.demo.service.config; + +import java.util.List; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import lombok.Data; + +/** + * @author Kamesh Shekhar prasad + */ + +@Configuration +@ConfigurationProperties(prefix = "openapi") +@Data +public class OpenApiProperties { + private InfoProperty info; + private AuthDemoServiceServer authDemoServiceServer; +} + +@Data +class InfoProperty { + private String title; + private String description; + private String version; + private LicenseProperty license; +} + +@Data +class LicenseProperty { + private String name; + private String url; +} + +@Data +class AuthDemoServiceServer { + private List servers; +} + +@Data +class Server { + private String description; + private String url; +} diff --git a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java index 4875ee300c8..46e39ef817c 100644 --- a/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java +++ b/authentication-demo-service/src/main/java/io/mosip/testrig/authentication/demo/service/config/SwaggerConfig.java @@ -1,120 +1,57 @@ package io.mosip.testrig.authentication.demo.service.config; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import jakarta.annotation.PostConstruct; - -import org.springframework.beans.factory.annotation.Value; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.ParameterBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.schema.ModelRef; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Parameter; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import io.swagger.v3.oas.models.servers.Server; -/** - * To expose the documentation for entire API. - * - * @author Dinesh Karuppiah - */ - -@Configuration(value = "ida_swagger_config") -@EnableSwagger2 +@Configuration public class SwaggerConfig { - private Boolean localEnv=true; - - @Value("${swagger.base-url:#{null}}") - private String swaggerUrl; - - @Value("${server.port:8080}") - private int serverPort; - - private String host; - private String proto = "http"; - private int port = -1; - - private String hostWithPort; + private static final Logger logger = LoggerFactory.getLogger(SwaggerConfig.class); - @PostConstruct - public void init() { - host = "localhost"; - hostWithPort = "localhost:" + serverPort; - } - - /** - * Set the api info. - * - * @return the api info - */ - ApiInfo getApiInfo() { - return new ApiInfoBuilder().title("Id Authentication Service").description("Id Authentication Service").build(); - } - - /** - * Docket bean provides more control over the API for Documentation Generation. - * - * @return the docket - */ + @Autowired + private OpenApiProperties openApiProperties; - /** - * Produce Docket bean - * - * @return Docket bean - */ @Bean - public Docket api() { - boolean targetSwagger = false; - if (!localEnv && swaggerUrl != null && !swaggerUrl.isEmpty()) { - try { - proto = new URL(swaggerUrl).getProtocol(); - host = new URL(swaggerUrl).getHost(); - port = new URL(swaggerUrl).getPort(); - if (port == -1) { - hostWithPort = host; - } else { - hostWithPort = host + ":" + port; - } - targetSwagger = true; - } catch (MalformedURLException e) { - System.err.println("SwaggerUrlException: " + e); + public OpenAPI openApi() { + String msg = "Swagger open api, "; + OpenAPI api = new OpenAPI() + .components(new Components()); + if (null != openApiProperties.getInfo()) { + api.info(new Info() + .title(openApiProperties.getInfo().getTitle()) + .version(openApiProperties.getInfo().getVersion()) + .description(openApiProperties.getInfo().getDescription())); + if (null != openApiProperties.getInfo().getLicense()) { + api.getInfo().license(new License() + .name(openApiProperties.getInfo().getLicense().getName()) + .url(openApiProperties.getInfo().getLicense().getUrl())); + logger.info(msg + "info license property is added"); + } else { + logger.error(msg + "info license property is empty"); } + logger.info(msg + "info property is added"); + } else { + logger.error(msg + "info property is empty"); } - ParameterBuilder aParameterBuilder = new ParameterBuilder(); - aParameterBuilder.name("Authorization").modelRef(new ModelRef("string")).parameterType("header").build(); - List aParameters = new ArrayList<>(); - aParameters.add(aParameterBuilder.build()); - Docket docket = new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.regex("(?!/(error|actuator).*).*")).build().globalOperationParameters(aParameters); - if (targetSwagger) { - docket.protocols(protocols()).host(hostWithPort); + if (null != openApiProperties.getAuthDemoServiceServer().getServers()) { + openApiProperties.getAuthDemoServiceServer().getServers().forEach(server -> { + api.addServersItem(new Server().description(server.getDescription()).url(server.getUrl())); + }); + logger.info(msg + "server property is added"); + } else { + logger.error(msg + "server property is empty"); } - - return docket; - } - - /** - * Protocols - * - * @return - */ - private Set protocols() { - Set protocols = new HashSet<>(); - protocols.add(proto); - return protocols; + return api; } } diff --git a/authentication-demo-service/src/main/resources/bootstrap.properties b/authentication-demo-service/src/main/resources/bootstrap.properties index 666dd99c850..a46f99a38ba 100644 --- a/authentication-demo-service/src/main/resources/bootstrap.properties +++ b/authentication-demo-service/src/main/resources/bootstrap.properties @@ -28,3 +28,15 @@ management.endpoints.web.exposure.include=info,health,refresh,restart,env #disabling health check so that client doesnt try to load properties from sprint config server every # 5 minutes (should not be done in production) health.config.enabled=true + +#Swagger 3.0 +openapi.info.title=Authentication Service API documentation +openapi.info.description=Authentication Service API documentation +openapi.info.version=1.0 +openapi.info.license.name=Mosip +openapi.info.license.url=https://docs.mosip.io/platform/license + +#------OpenApi properties-------- +mosipbox.public.url=http://localhost:8082 +openapi.authDemoServiceServer.servers[0].url=${mosipbox.public.url}/v1/identity +openapi.authDemoServiceServer.servers[0].description=Authentication Demo Service \ No newline at end of file From 3d450ef4efc06779727b18bbcc7e86434f7e295e Mon Sep 17 00:00:00 2001 From: kameshsr Date: Wed, 26 Jun 2024 12:44:47 +0530 Subject: [PATCH 05/19] MOSIP-34016 Fixed build failure Signed-off-by: kameshsr --- authentication-demo-service/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/authentication-demo-service/pom.xml b/authentication-demo-service/pom.xml index 0f7a54a8cf0..557d5c53ffe 100644 --- a/authentication-demo-service/pom.xml +++ b/authentication-demo-service/pom.xml @@ -62,7 +62,7 @@ - 2.0.2.RELEASE + 3.2.3 2.0.0.RELEASE 21 @@ -286,6 +286,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring.boot.version} true ZIP From 4650f3f8aece806e8f18966419db62f88db0ce69 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Wed, 26 Jun 2024 15:07:11 +0530 Subject: [PATCH 06/19] MOSIP-34016 Fixed build issue Signed-off-by: kameshsr --- .github/workflows/authdemo-push-trigger.yml | 8 ++++---- authentication-demo-service/Dockerfile | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/authdemo-push-trigger.yml b/.github/workflows/authdemo-push-trigger.yml index 23cfb02cc5c..98e93e55b2a 100644 --- a/.github/workflows/authdemo-push-trigger.yml +++ b/.github/workflows/authdemo-push-trigger.yml @@ -24,7 +24,7 @@ on: jobs: build-maven-authentication-demo-service: - uses: mosip/kattu/.github/workflows/maven-build.yml@master + uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 with: SERVICE_LOCATION: ./authentication-demo-service BUILD_ARTIFACT: authentication-demo-service @@ -45,7 +45,7 @@ jobs: BUILD_ARTIFACT: 'authentication-demo-service' fail-fast: false name: ${{ matrix.SERVICE_NAME }} - uses: mosip/kattu/.github/workflows/docker-build.yml@master + uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21 with: SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} SERVICE_NAME: ${{ matrix.SERVICE_NAME }} @@ -59,7 +59,7 @@ jobs: publish_to_nexus: if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}" needs: build-maven-authentication-demo-service - uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master + uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21 with: SERVICE_LOCATION: ./authentication-demo-service secrets: @@ -74,7 +74,7 @@ jobs: sonar_analysis: needs: build-maven-authentication-demo-service if: "${{ github.event_name != 'pull_request' }}" - uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master + uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21 with: SERVICE_LOCATION: ./authentication-demo-service secrets: diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index c93f0a71f5c..ca992443128 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:11 +FROM eclipse-temurin:21-jre-alpine ARG SOURCE ARG COMMIT_HASH @@ -46,16 +46,16 @@ ARG container_user=mosip ARG container_user_group=mosip # can be passed during Docker build as build time environment for github branch to pickup configuration from. -ARG container_user_uid=1001 +ARG container_user_uid=1002 # can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_gid=1001 # install packages and create user -RUN apt-get -y update \ -&& apt-get install -y unzip \ -&& groupadd -g ${container_user_gid} ${container_user_group} \ -&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user} +RUN apk -q update \ +&& apk add -q unzip wget \ +&& addgroup -g ${container_user_gid} ${container_user_group} \ +&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} # set working directory for the user WORKDIR /home/${container_user} From 14f44d3a865ba8a74479445c7f59373e07b25797 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Wed, 26 Jun 2024 18:07:59 +0530 Subject: [PATCH 07/19] Fixed docker build issue Signed-off-by: kameshsr --- authentication-demo-service/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index ca992443128..785aec1ebb3 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -75,9 +75,9 @@ ADD entrypoint.sh $work_dir/entrypoint.sh RUN chmod +x $work_dir/entrypoint.sh # change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} /usr/local/openjdk-11/lib/security/cacerts +RUN chown -R ${container_user}:${container_user} /home/${container_user} /usr/local/openjdk-21/lib/security/cacerts -RUN chmod 644 /usr/local/openjdk-11/lib/security/cacerts +RUN chmod 644 /usr/local/openjdk-21/lib/security/cacerts # select container user for all tasks USER ${container_user_uid}:${container_user_gid} From 7fa6deb6cc661e91dc19db02df1818ff621bcc3f Mon Sep 17 00:00:00 2001 From: techno-467 Date: Thu, 27 Jun 2024 11:32:57 +0530 Subject: [PATCH 08/19] updated Signed-off-by: techno-467 --- authentication-demo-service/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index 785aec1ebb3..7deafc01366 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -74,8 +74,10 @@ ADD entrypoint.sh $work_dir/entrypoint.sh RUN chmod +x $work_dir/entrypoint.sh -# change permissions of file inside working dir -RUN chown -R ${container_user}:${container_user} /home/${container_user} /usr/local/openjdk-21/lib/security/cacerts +# Separate the chown commands +RUN chown -R ${container_user}:${container_user} /home/${container_user} + +RUN chown ${container_user}:${container_user} /usr/local/openjdk-21/lib/security/cacerts RUN chmod 644 /usr/local/openjdk-21/lib/security/cacerts From 358126010d66471b16ece938a6c98b7ea4c4dbdc Mon Sep 17 00:00:00 2001 From: techno-467 Date: Thu, 27 Jun 2024 11:43:13 +0530 Subject: [PATCH 09/19] updated Signed-off-by: techno-467 --- authentication-demo-service/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index 7deafc01366..1dd380009ee 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -74,11 +74,14 @@ ADD entrypoint.sh $work_dir/entrypoint.sh RUN chmod +x $work_dir/entrypoint.sh + +# Check if the path exists + +RUN ls -l /usr/local/openjdk-21/lib/security/cacerts || echo "Path does not exist" + # Separate the chown commands RUN chown -R ${container_user}:${container_user} /home/${container_user} -RUN chown ${container_user}:${container_user} /usr/local/openjdk-21/lib/security/cacerts - RUN chmod 644 /usr/local/openjdk-21/lib/security/cacerts # select container user for all tasks From aa7064779589219a47ae78fc3c239bef2bfb24c6 Mon Sep 17 00:00:00 2001 From: techno-467 Date: Thu, 27 Jun 2024 11:54:08 +0530 Subject: [PATCH 10/19] updated Signed-off-by: techno-467 --- authentication-demo-service/Dockerfile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index 1dd380009ee..81cb53143cf 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -53,9 +53,9 @@ ARG container_user_gid=1001 # install packages and create user RUN apk -q update \ -&& apk add -q unzip wget \ -&& addgroup -g ${container_user_gid} ${container_user_group} \ -&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} + && apk add -q unzip wget \ + && addgroup -g ${container_user_gid} ${container_user_group} \ + && adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} # set working directory for the user WORKDIR /home/${container_user} @@ -75,14 +75,17 @@ ADD entrypoint.sh $work_dir/entrypoint.sh RUN chmod +x $work_dir/entrypoint.sh -# Check if the path exists +# Debugging step: Check if the file exists and display permissions -RUN ls -l /usr/local/openjdk-21/lib/security/cacerts || echo "Path does not exist" +RUN ls -l /usr/local/openjdk-21/lib/security/cacerts || echo "File does not exist" \ + && ls -ld /usr/local/openjdk-21/lib/security # Separate the chown commands RUN chown -R ${container_user}:${container_user} /home/${container_user} -RUN chmod 644 /usr/local/openjdk-21/lib/security/cacerts + +# Conditionally run chmod if the file exists +RUN if [ -f /usr/local/openjdk-21/lib/security/cacerts ]; then chmod 644 /usr/local/openjdk-21/lib/security/cacerts; fi # select container user for all tasks USER ${container_user_uid}:${container_user_gid} From 050e1ab694955d1d1adb50675593a829065e3523 Mon Sep 17 00:00:00 2001 From: techno-467 Date: Thu, 27 Jun 2024 12:02:34 +0530 Subject: [PATCH 11/19] updated Signed-off-by: techno-467 --- authentication-demo-service/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index 81cb53143cf..f7077b34ae8 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -84,8 +84,9 @@ RUN ls -l /usr/local/openjdk-21/lib/security/cacerts || echo "File does not exis RUN chown -R ${container_user}:${container_user} /home/${container_user} -# Conditionally run chmod if the file exists -RUN if [ -f /usr/local/openjdk-21/lib/security/cacerts ]; then chmod 644 /usr/local/openjdk-21/lib/security/cacerts; fi + +# Debugging step: Check if the directory exists and display permissions +RUN ls -ld /usr/local/openjdk-21/lib/security || echo "Directory does not exist" # select container user for all tasks USER ${container_user_uid}:${container_user_gid} From bf7a7a2c66653b17aac5feddc7a86d9f187f3cb8 Mon Sep 17 00:00:00 2001 From: techno-467 Date: Thu, 27 Jun 2024 12:44:02 +0530 Subject: [PATCH 12/19] updated Signed-off-by: techno-467 --- authentication-demo-service/Dockerfile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index f7077b34ae8..0fc6720946a 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -74,19 +74,18 @@ ADD entrypoint.sh $work_dir/entrypoint.sh RUN chmod +x $work_dir/entrypoint.sh +# Ensure the directory exists and create a dummy file if it does not exist -# Debugging step: Check if the file exists and display permissions +RUN mkdir -p /usr/local/openjdk-21/lib/security \ + && touch /usr/local/openjdk-21/lib/security/cacerts -RUN ls -l /usr/local/openjdk-21/lib/security/cacerts || echo "File does not exist" \ - && ls -ld /usr/local/openjdk-21/lib/security - -# Separate the chown commands -RUN chown -R ${container_user}:${container_user} /home/${container_user} +# Change ownership and permissions +RUN chown ${container_user}:${container_user} /usr/local/openjdk-21/lib/security/cacerts \ + && chmod 644 /usr/local/openjdk-21/lib/security/cacerts +# Separate the chown commands for home directory - -# Debugging step: Check if the directory exists and display permissions -RUN ls -ld /usr/local/openjdk-21/lib/security || echo "Directory does not exist" +RUN chown -R ${container_user}:${container_user} /home/${container_user} # select container user for all tasks USER ${container_user_uid}:${container_user_gid} From bf46182199d19c35983c9633197d8b2df9ed8cc3 Mon Sep 17 00:00:00 2001 From: techno-467 Date: Thu, 27 Jun 2024 12:52:06 +0530 Subject: [PATCH 13/19] updated Signed-off-by: techno-467 --- authentication-demo-service/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index 0fc6720946a..821542daefb 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -75,7 +75,6 @@ ADD entrypoint.sh $work_dir/entrypoint.sh RUN chmod +x $work_dir/entrypoint.sh # Ensure the directory exists and create a dummy file if it does not exist - RUN mkdir -p /usr/local/openjdk-21/lib/security \ && touch /usr/local/openjdk-21/lib/security/cacerts From f5d57cb4f1ccdba17d2262e3e4ea7edb405ec8ea Mon Sep 17 00:00:00 2001 From: Praful Rakhade <99539100+Prafulrakhade@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:22:26 +0530 Subject: [PATCH 14/19] Update Dockerfile Signed-off-by: Praful Rakhade <99539100+Prafulrakhade@users.noreply.github.com> --- authentication-demo-service/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index 821542daefb..bd77c0fa220 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -83,7 +83,6 @@ RUN chown ${container_user}:${container_user} /usr/local/openjdk-21/lib/security && chmod 644 /usr/local/openjdk-21/lib/security/cacerts # Separate the chown commands for home directory - RUN chown -R ${container_user}:${container_user} /home/${container_user} # select container user for all tasks From df56552b5630cd685f6dd8f88bb1835b169dc158 Mon Sep 17 00:00:00 2001 From: Praful Rakhade <99539100+Prafulrakhade@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:08:59 +0530 Subject: [PATCH 15/19] Update Dockerfile Signed-off-by: Praful Rakhade <99539100+Prafulrakhade@users.noreply.github.com> --- authentication-demo-service/Dockerfile | 31 +++++++++----------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index bd77c0fa220..9d38963fa09 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -51,12 +51,6 @@ ARG container_user_uid=1002 # can be passed during Docker build as build time environment for github branch to pickup configuration from. ARG container_user_gid=1001 -# install packages and create user -RUN apk -q update \ - && apk add -q unzip wget \ - && addgroup -g ${container_user_gid} ${container_user_group} \ - && adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} - # set working directory for the user WORKDIR /home/${container_user} @@ -64,26 +58,23 @@ ENV work_dir=/home/${container_user} ARG loader_path=${work_dir}/additional_jars/ -RUN mkdir -p ${loader_path} - ENV loader_path_env=${loader_path} COPY ./target/authentication-demo-service-*.jar authentication-demo-service.jar ADD entrypoint.sh $work_dir/entrypoint.sh -RUN chmod +x $work_dir/entrypoint.sh - -# Ensure the directory exists and create a dummy file if it does not exist -RUN mkdir -p /usr/local/openjdk-21/lib/security \ - && touch /usr/local/openjdk-21/lib/security/cacerts - -# Change ownership and permissions -RUN chown ${container_user}:${container_user} /usr/local/openjdk-21/lib/security/cacerts \ - && chmod 644 /usr/local/openjdk-21/lib/security/cacerts - -# Separate the chown commands for home directory -RUN chown -R ${container_user}:${container_user} /home/${container_user} +# install packages and create user +RUN apk -q update \ + && apk add -q unzip wget \ + && addgroup -g ${container_user_gid} ${container_user_group} \ + && adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} \ + && mkdir -p ${loader_path} \ + && chmod +x $work_dir/entrypoint.sh \ + && mkdir -p /usr/local/openjdk-21/lib/security && touch /usr/local/openjdk-21/lib/security/cacerts \ + && chown ${container_user}:${container_user} /usr/local/openjdk-21/lib/security/cacerts \ + && chmod 644 /usr/local/openjdk-21/lib/security/cacerts \ + && chown -R ${container_user}:${container_user} /home/${container_user} # select container user for all tasks USER ${container_user_uid}:${container_user_gid} From 0b9d0f0a3638abf7a337d4cfc43fbf8535883bee Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 2 Jul 2024 15:57:49 +0530 Subject: [PATCH 16/19] MOSIP-34016 Corrected git commit id plugin Signed-off-by: kameshsr --- authentication-demo-service/pom.xml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/authentication-demo-service/pom.xml b/authentication-demo-service/pom.xml index 557d5c53ffe..07fa2f8055d 100644 --- a/authentication-demo-service/pom.xml +++ b/authentication-demo-service/pom.xml @@ -325,8 +325,27 @@ pl.project13.maven git-commit-id-plugin 3.0.1 + + + get-the-git-infos + + revision + + validate + + + + true + ${project.build.outputDirectory}/service-git.properties + + ^git.build.(time|version)$ + ^git.commit.id.(abbrev|full)$ + + full + ${project.basedir}/.git + + - org.apache.maven.plugins maven-compiler-plugin From bdf1c06fbc20322fd6b227bffccf3f393ff296c2 Mon Sep 17 00:00:00 2001 From: Mohan E Date: Wed, 3 Jul 2024 17:52:57 +0530 Subject: [PATCH 17/19] [DSD-5636] Updated Dockerfile. Signed-off-by: Mohan E --- authentication-demo-service/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authentication-demo-service/Dockerfile b/authentication-demo-service/Dockerfile index 9d38963fa09..178cadc86a5 100644 --- a/authentication-demo-service/Dockerfile +++ b/authentication-demo-service/Dockerfile @@ -66,7 +66,7 @@ ADD entrypoint.sh $work_dir/entrypoint.sh # install packages and create user RUN apk -q update \ - && apk add -q unzip wget \ + && apk add -q unzip wget bash \ && addgroup -g ${container_user_gid} ${container_user_group} \ && adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} \ && mkdir -p ${loader_path} \ From 773faaa40da32b4675428eb5d6efb2a76bb8cc55 Mon Sep 17 00:00:00 2001 From: Mohan E Date: Wed, 3 Jul 2024 18:29:27 +0530 Subject: [PATCH 18/19] [DSD-5636] Updated authdemo-push-trigger.yml Signed-off-by: Mohan E --- .github/workflows/authdemo-push-trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/authdemo-push-trigger.yml b/.github/workflows/authdemo-push-trigger.yml index 98e93e55b2a..3293fe1e379 100644 --- a/.github/workflows/authdemo-push-trigger.yml +++ b/.github/workflows/authdemo-push-trigger.yml @@ -72,8 +72,8 @@ jobs: sonar_analysis: + if: "${{ github.event_name != 'pull_request' }}" needs: build-maven-authentication-demo-service - if: "${{ github.event_name != 'pull_request' }}" uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21 with: SERVICE_LOCATION: ./authentication-demo-service From 9f5130b54d943ee22d07e6571adaf21c553ee785 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Thu, 4 Jul 2024 11:50:01 +0530 Subject: [PATCH 19/19] Corrected pom version Signed-off-by: kameshsr --- authentication-demo-service/pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/authentication-demo-service/pom.xml b/authentication-demo-service/pom.xml index 07fa2f8055d..03431a62dac 100644 --- a/authentication-demo-service/pom.xml +++ b/authentication-demo-service/pom.xml @@ -4,7 +4,7 @@ io.mosip.testrig.authentication.demo - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT authentication-demo-service authentication-demo-service Parent project of MOSIP functional tests @@ -73,7 +73,7 @@ 0.8.2 true - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT @@ -104,7 +104,7 @@ io.mosip.authentication authentication-core - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT commons-codec @@ -125,7 +125,7 @@ io.mosip.kernel kernel-core - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT org.springframework.boot @@ -206,7 +206,7 @@ io.mosip.kernel kernel-templatemanager-velocity - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT org.springframework.cloud @@ -229,7 +229,7 @@ io.mosip.kernel kernel-keymanager-service - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT lib @@ -260,7 +260,7 @@ io.mosip.kernel kernel-bom - 1.2.1-java21-SNAPSHOT + 1.2.1-SNAPSHOT pom import