diff --git a/docker-compose/README.md b/docker-compose/README.md index 38266913..625e1684 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -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 diff --git a/docker-compose/dependent-docker-compose.yml b/docker-compose/dependent-docker-compose.yml index 2e5558b0..a5a28892 100644 --- a/docker-compose/dependent-docker-compose.yml +++ b/docker-compose/dependent-docker-compose.yml @@ -54,7 +54,7 @@ services: esignet: - image: 'mosipdev/esignet:release-1.5.x' + image: 'mosipdev/esignet-with-plugins' user: root ports: - 8088:8088 diff --git a/signup-service/pom.xml b/signup-service/pom.xml index b2657fdc..25f72e29 100644 --- a/signup-service/pom.xml +++ b/signup-service/pom.xml @@ -200,6 +200,12 @@ shedlock-provider-redis-spring 4.47.0 + + + io.mosip.kernel + kernel-auth-adapter-lite + 1.2.0.1-B4 + @@ -221,51 +227,6 @@ - - org.apache.maven.plugins - maven-dependency-plugin - 3.5.0 - - - copy - package - - copy - - - - - - - io.mosip.kernel - kernel-auth-adapter-lite - ${kernel-auth-adapter-lite.version} - ${signup-plugins.location} - ${kernel-auth-adapter-lite.fileName} - jar - - - io.mosip.esignet - mosip-identity-plugin - ${mosip-identity-plugin.version} - ${signup-plugins.location} - ${mosip-identity-plugin.fileName} - jar - - - io.mosip.esignet - mock-plugin - ${signup-mock-plugin.version} - ${signup-plugins.location} - ${signup-mock-plugin.fileName} - jar - - - true - true - true - - diff --git a/signup-service/src/test/java/io/mosip/signup/controllers/CsrfControllerTest.java b/signup-service/src/test/java/io/mosip/signup/controllers/CsrfControllerTest.java index 42de8c70..5ddda9be 100644 --- a/signup-service/src/test/java/io/mosip/signup/controllers/CsrfControllerTest.java +++ b/signup-service/src/test/java/io/mosip/signup/controllers/CsrfControllerTest.java @@ -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; @@ -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 diff --git a/signup-service/src/test/java/io/mosip/signup/controllers/IdentityVerificationControllerTest.java b/signup-service/src/test/java/io/mosip/signup/controllers/IdentityVerificationControllerTest.java index 12853ff3..22db850c 100644 --- a/signup-service/src/test/java/io/mosip/signup/controllers/IdentityVerificationControllerTest.java +++ b/signup-service/src/test/java/io/mosip/signup/controllers/IdentityVerificationControllerTest.java @@ -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; @@ -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; @@ -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 { diff --git a/signup-service/src/test/java/io/mosip/signup/controllers/RegistrationControllerTest.java b/signup-service/src/test/java/io/mosip/signup/controllers/RegistrationControllerTest.java index ff5a5a2f..65d09dc4 100644 --- a/signup-service/src/test/java/io/mosip/signup/controllers/RegistrationControllerTest.java +++ b/signup-service/src/test/java/io/mosip/signup/controllers/RegistrationControllerTest.java @@ -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; @@ -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; @@ -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 { diff --git a/signup-service/src/test/java/io/mosip/signup/controllers/ResetPasswordControllerTest.java b/signup-service/src/test/java/io/mosip/signup/controllers/ResetPasswordControllerTest.java index 830e3239..08e62546 100644 --- a/signup-service/src/test/java/io/mosip/signup/controllers/ResetPasswordControllerTest.java +++ b/signup-service/src/test/java/io/mosip/signup/controllers/ResetPasswordControllerTest.java @@ -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; @@ -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; @@ -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 { diff --git a/signup-service/src/test/java/io/mosip/signup/controllers/SignUpControllerTest.java b/signup-service/src/test/java/io/mosip/signup/controllers/SignUpControllerTest.java index 85b62ec2..a994021a 100644 --- a/signup-service/src/test/java/io/mosip/signup/controllers/SignUpControllerTest.java +++ b/signup-service/src/test/java/io/mosip/signup/controllers/SignUpControllerTest.java @@ -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; @@ -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; @@ -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 { diff --git a/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java b/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java index 68def318..863481f7 100644 --- a/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java +++ b/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java @@ -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; @@ -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; @@ -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 { diff --git a/signup-service/src/test/resources/application-test.properties b/signup-service/src/test/resources/application-test.properties index 2c45f898..adc88835 100644 --- a/signup-service/src/test/resources/application-test.properties +++ b/signup-service/src/test/resources/application-test.properties @@ -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 diff --git a/signup-with-plugins/Dockerfile b/signup-with-plugins/Dockerfile index c61bf910..ad442ad8 100644 --- a/signup-with-plugins/Dockerfile +++ b/signup-with-plugins/Dockerfile @@ -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} \ No newline at end of file +COPY ./target/*.jar ${plugins_path_env} \ No newline at end of file diff --git a/signup-with-plugins/pom.xml b/signup-with-plugins/pom.xml index 5aa0c2d0..58975556 100644 --- a/signup-with-plugins/pom.xml +++ b/signup-with-plugins/pom.xml @@ -24,8 +24,6 @@ esignet-mock-plugin.jar 1.3.1-SNAPSHOT mosip-identity-plugin.jar - 1.2.0.1-B4 - kernel-auth-adapter-lite.jar @@ -45,14 +43,6 @@ - - io.mosip.kernel - kernel-auth-adapter-lite - ${kernel-auth-adapter-lite.version} - ${signup-plugins.location} - ${kernel-auth-adapter-lite.fileName} - jar - io.mosip.esignet mosip-identity-plugin