Skip to content

Commit

Permalink
ES-2130 ES-2142 ES-2143
Browse files Browse the repository at this point in the history
Signed-off-by: ase-101 <sunkadaeanusha@gmail.com>
  • Loading branch information
ase-101 committed Jan 8, 2025
1 parent 1fe61a3 commit 5108d75
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 67 deletions.
3 changes: 1 addition & 2 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ This is the docker-compose setup to run eSignet Signup service with mock identit
1. Run `docker compose --file dependent-docker-compose.yml up` to start all the dependent services.
2. Go to [signup-with-plugins](../signup-with-plugins) folder and run `mvn clean install -Dgpg.skip=true` from the command line.
3. Add [esignet-mock-plugin.jar](../signup-with-plugins/target/esignet-mock-plugin.jar) to signup-service classpath in your IDE.
4. Add [kernel-auth-adapter-lite.jar](../signup-with-plugins/target/kernel-auth-adapter-lite.jar) to signup-service classpath in your IDE.
5. Update below properties in [application-local.properties](../signup-service/src/main/resources/application-local.properties) with valid values:
4. Update below properties in [application-local.properties](../signup-service/src/main/resources/application-local.properties) with valid values:

mosip.internal.domain.url=https://api-internal.dev.mosip.net

Expand Down
2 changes: 1 addition & 1 deletion docker-compose/dependent-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:


esignet:
image: 'mosipdev/esignet:release-1.5.x'
image: 'mosipdev/esignet-with-plugins'
user: root
ports:
- 8088:8088
Expand Down
51 changes: 6 additions & 45 deletions signup-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@
<artifactId>shedlock-provider-redis-spring</artifactId>
<version>4.47.0</version>
</dependency>

<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter-lite</artifactId>
<version>1.2.0.1-B4</version>
</dependency>
</dependencies>

<build>
Expand All @@ -221,51 +227,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter-lite</artifactId>
<version>${kernel-auth-adapter-lite.version}</version>
<outputDirectory>${signup-plugins.location}</outputDirectory>
<destFileName>${kernel-auth-adapter-lite.fileName}</destFileName>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>io.mosip.esignet</groupId>
<artifactId>mosip-identity-plugin</artifactId>
<version>${mosip-identity-plugin.version}</version>
<outputDirectory>${signup-plugins.location}</outputDirectory>
<destFileName>${mosip-identity-plugin.fileName}</destFileName>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>io.mosip.esignet</groupId>
<artifactId>mock-plugin</artifactId>
<version>${signup-mock-plugin.version}</version>
<outputDirectory>${signup-plugins.location}</outputDirectory>
<destFileName>${signup-mock-plugin.fileName}</destFileName>
<type>jar</type>
</artifactItem>
</artifactItems>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.mosip.kernel.auth.defaultadapter.config.SecurityConfig;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.http.MediaType;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.security.web.csrf.DefaultCsrfToken;
Expand All @@ -25,7 +27,9 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@RunWith(SpringRunner.class)
@WebMvcTest(value = CsrfController.class, excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@WebMvcTest(value = CsrfController.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {SecurityConfig.class}),
excludeAutoConfiguration = {SecurityAutoConfiguration.class})
class CsrfControllerTest {

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

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.mosip.kernel.auth.defaultadapter.config.SecurityConfig;
import io.mosip.signup.dto.*;
import io.mosip.esignet.core.dto.RequestWrapper;
import io.mosip.signup.dto.InitiateIdentityVerificationRequest;
Expand All @@ -26,6 +27,8 @@
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
Expand All @@ -38,7 +41,9 @@
import java.time.format.DateTimeFormatter;

@RunWith(SpringRunner.class)
@WebMvcTest(value = IdentityVerificationController.class, excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@WebMvcTest(value = IdentityVerificationController.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {SecurityConfig.class}),
excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@ActiveProfiles(value = {"test"})
public class IdentityVerificationControllerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.mosip.esignet.core.dto.RequestWrapper;
import io.mosip.esignet.core.exception.EsignetException;
import io.mosip.esignet.core.util.IdentityProviderUtil;
import io.mosip.kernel.auth.defaultadapter.config.SecurityConfig;
import io.mosip.signup.api.dto.ProfileDto;
import io.mosip.signup.api.exception.InvalidProfileException;
import io.mosip.signup.api.spi.ProfileRegistryPlugin;
Expand All @@ -28,6 +29,8 @@
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
Expand Down Expand Up @@ -55,7 +58,9 @@


@RunWith(SpringRunner.class)
@WebMvcTest(value = RegistrationController.class, excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@WebMvcTest(value = RegistrationController.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {SecurityConfig.class}),
excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@ActiveProfiles(value = {"test"})
public class RegistrationControllerTest {

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

import com.fasterxml.jackson.databind.ObjectMapper;
import io.mosip.esignet.core.dto.RequestWrapper;
import io.mosip.kernel.auth.defaultadapter.config.SecurityConfig;
import io.mosip.signup.api.util.ProfileCreateUpdateStatus;
import io.mosip.signup.dto.RegistrationStatusResponse;
import io.mosip.signup.dto.ResetPasswordRequest;
Expand All @@ -20,6 +21,8 @@
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
Expand All @@ -39,7 +42,9 @@


@RunWith(SpringRunner.class)
@WebMvcTest(value = ResetPasswordController.class, excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@WebMvcTest(value = ResetPasswordController.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {SecurityConfig.class}),
excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@ActiveProfiles(value = {"test"})
public class ResetPasswordControllerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package io.mosip.signup.controllers;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.mosip.kernel.auth.defaultadapter.config.SecurityConfig;
import io.mosip.signup.helper.AuditHelper;
import io.mosip.signup.services.RegistrationService;
import org.junit.Test;
Expand All @@ -14,6 +15,8 @@
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
Expand All @@ -26,7 +29,9 @@


@RunWith(SpringRunner.class)
@WebMvcTest(value = SignUpController.class, excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@WebMvcTest(value = SignUpController.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {SecurityConfig.class}),
excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@ActiveProfiles(value = {"test"})
public class SignUpControllerTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.mosip.signup.controllers;

import io.mosip.kernel.auth.defaultadapter.config.SecurityConfig;
import io.mosip.signup.api.dto.IdentityVerificationResult;
import io.mosip.signup.api.exception.IdentityVerifierException;
import io.mosip.signup.dto.IdentityVerificationRequest;
Expand All @@ -17,6 +18,8 @@
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.util.ReflectionTestUtils;
Expand All @@ -30,7 +33,9 @@


@RunWith(SpringRunner.class)
@WebMvcTest(value = WebSocketController.class, excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@WebMvcTest(value = WebSocketController.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {SecurityConfig.class}),
excludeAutoConfiguration = {SecurityAutoConfiguration.class})
@ActiveProfiles(value = {"test"})
public class WebSocketControllerTest {

Expand Down
2 changes: 2 additions & 0 deletions signup-service/src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ mosip.iam.adapter.self-token-renewal-enable=true
mosip.service-context=${server.servlet.context-path}
mosip.service.end-points=/**/*
mosip.service.exclude.auth.allowed.method=GET,POST
mosip.security.csrf-enable=false
mosip.security.cors-enable=false

## -------------------------- External endpoints -----------------------------------------------------------------------
mosip.signup.integration.impl.basepackage=io.signup.plugin.mosipid
Expand Down
3 changes: 1 addition & 2 deletions signup-with-plugins/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM mosipdev/signup-service

# copy all files under target to the plugins folder
COPY ./target/*-plugin.jar ${plugins_path_env}
COPY ./target/kernel-auth-adapter-lite.jar ${loader_path_env}
COPY ./target/*.jar ${plugins_path_env}
10 changes: 0 additions & 10 deletions signup-with-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
<signup-mock-plugin.fileName>esignet-mock-plugin.jar</signup-mock-plugin.fileName>
<mosip-identity-plugin.version>1.3.1-SNAPSHOT</mosip-identity-plugin.version>
<mosip-identity-plugin.fileName>mosip-identity-plugin.jar</mosip-identity-plugin.fileName>
<kernel-auth-adapter-lite.version>1.2.0.1-B4</kernel-auth-adapter-lite.version>
<kernel-auth-adapter-lite.fileName>kernel-auth-adapter-lite.jar</kernel-auth-adapter-lite.fileName>
</properties>

<build>
Expand All @@ -45,14 +43,6 @@
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter-lite</artifactId>
<version>${kernel-auth-adapter-lite.version}</version>
<outputDirectory>${signup-plugins.location}</outputDirectory>
<destFileName>${kernel-auth-adapter-lite.fileName}</destFileName>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>io.mosip.esignet</groupId>
<artifactId>mosip-identity-plugin</artifactId>
Expand Down

0 comments on commit 5108d75

Please sign in to comment.