diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml
index 6a4f26c3834..cdfa184e8e3 100644
--- a/.github/workflows/push-trigger.yml
+++ b/.github/workflows/push-trigger.yml
@@ -18,12 +18,12 @@ on:
- release*
- master
- 1.*
- - develop
+ - develop*
- MOSIP*
jobs:
build-maven-authentication:
- uses: mosip/kattu/.github/workflows/maven-build.yml@master
+ uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: ./authentication
BUILD_ARTIFACT: authentication
@@ -37,7 +37,7 @@ jobs:
publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}"
needs: build-maven-authentication
- 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
secrets:
@@ -64,7 +64,7 @@ jobs:
BUILD_ARTIFACT: 'authentication'
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 }}
@@ -78,7 +78,7 @@ jobs:
sonar_analysis:
needs: build-maven-authentication
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
secrets:
diff --git a/README.md b/README.md
index f31482596f2..7cc9c1cfb61 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-[![Maven Package upon a push](https://github.com/mosip/id-authentication/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/id-authentication/actions/workflows/push_trigger.yml)
-[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_id-authentication&id=mosip_id-authentication&branch=release-1.2.0.1&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_id-authentication&branch=release-1.2.0.1)
+[![Maven Package upon a push](https://github.com/mosip/id-authentication/actions/workflows/push-trigger.yml/badge.svg?branch=develop-java21)](https://github.com/mosip/id-authentication/actions/workflows/push-trigger.yml)
+[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_id-authentication&id=mosip_id-authentication&branch=develop-java21&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_id-authentication&branch=develop-java21)
# ID-Authentication
diff --git a/authentication/authentication-authtypelockfilter-impl/pom.xml b/authentication/authentication-authtypelockfilter-impl/pom.xml
index 731f41e8b3b..96b67740f12 100644
--- a/authentication/authentication-authtypelockfilter-impl/pom.xml
+++ b/authentication/authentication-authtypelockfilter-impl/pom.xml
@@ -17,8 +17,8 @@
UTF-8
- 11
- 11
+ 21
+ 21
3.8.0
@@ -30,14 +30,9 @@
2.3
- 2.0.2.RELEASE
- 2.0.7.RELEASE
5.0.5.RELEASE
- 2.0.4.RELEASE
- 2.0.7
- 1.5.21
2.9.2
@@ -80,9 +75,7 @@
1.1.1
- 3.6.1
3.7
- 2.6
1.11
4.3
1.9.2
@@ -118,8 +111,8 @@
UTF-8
- 11
- 11
+ 21
+ 21
3.8.0
@@ -131,14 +124,9 @@
2.3
- 2.0.2.RELEASE
- 2.0.7.RELEASE
5.0.5.RELEASE
- 2.0.4.RELEASE
- 2.0.7
- 1.5.21
2.9.2
@@ -224,7 +212,6 @@
org.projectlombok
lombok
- ${lombok.version}
compile
@@ -279,27 +266,12 @@
org.springdoc
- springdoc-openapi-ui
+ springdoc-openapi-starter-webmvc-ui
${springdoc.version}
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
- com.fasterxml.jackson.core
- jackson-annotations
-
-
- com.fasterxml.jackson.core
- jackson-core
-
-
org.springframework.boot
spring-boot-starter-webflux
- ${spring.boot.version}
com.fasterxml.jackson.core
@@ -331,7 +303,6 @@
com.fasterxml.jackson.module
jackson-module-jaxb-annotations
- ${jackson.version}
com.fasterxml.jackson.core
@@ -350,7 +321,6 @@
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
- ${jackson.version}
com.fasterxml.jackson.core
diff --git a/authentication/authentication-authtypelockfilter-impl/src/test/java/io/mosip/authentication/authtypelockfilter/impl/AuthTypeLockFilterImplTest.java b/authentication/authentication-authtypelockfilter-impl/src/test/java/io/mosip/authentication/authtypelockfilter/impl/AuthTypeLockFilterImplTest.java
index 1bde5ca11c4..99367ad8979 100644
--- a/authentication/authentication-authtypelockfilter-impl/src/test/java/io/mosip/authentication/authtypelockfilter/impl/AuthTypeLockFilterImplTest.java
+++ b/authentication/authentication-authtypelockfilter-impl/src/test/java/io/mosip/authentication/authtypelockfilter/impl/AuthTypeLockFilterImplTest.java
@@ -10,15 +10,16 @@
import io.mosip.authentication.core.constant.IdAuthenticationErrorConstants;
import io.mosip.authentication.core.indauth.dto.*;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestContext;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.context.WebApplicationContext;
@@ -31,7 +32,9 @@
import io.mosip.idrepository.core.dto.AuthtypeStatus;
import io.mosip.kernel.templatemanager.velocity.builder.TemplateManagerBuilderImpl;
-@RunWith(SpringRunner.class)
+import static org.mockito.Mockito.lenient;
+
+@RunWith(MockitoJUnitRunner.class)
@WebMvcTest
@ContextConfiguration(classes = { TestContext.class, WebApplicationContext.class, TemplateManagerBuilderImpl.class })
public class AuthTypeLockFilterImplTest {
@@ -132,7 +135,7 @@ public void TestvalidateAuthTypeStatusOTPLocked() throws Throwable {
status1.setAuthSubType("phone");
status1.setLocked(true);
authtypeStatusList.add(status1);
- Mockito.when(authTypeStatusService.fetchAuthtypeStatus(Mockito.anyString())).thenReturn(authtypeStatusList);
+ lenient().when(authTypeStatusService.fetchAuthtypeStatus(Mockito.anyString())).thenReturn(authtypeStatusList);
try {
ReflectionTestUtils.invokeMethod(authTypeLockFilterImpl, "validateAuthTypeStatus", authRequestDTO, status,
authtypeStatusList);
@@ -196,7 +199,6 @@ public void validateExceptionTest2() throws IdAuthenticationBusinessException {
status.setLocked(true);
List authtypeStatusList = new ArrayList<>();
authtypeStatusList.add(status);
- System.out.println("1= "+authtypeStatusList);
IdAuthenticationBusinessException exception = new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.AUTH_TYPE_LOCKED.getErrorCode(),
String.format(IdAuthenticationErrorConstants.AUTH_TYPE_LOCKED.getErrorMessage(),
MatchType.Category.SPIN.getType()));
diff --git a/authentication/authentication-common/pom.xml b/authentication/authentication-common/pom.xml
index c23f987920c..0c424e11695 100644
--- a/authentication/authentication-common/pom.xml
+++ b/authentication/authentication-common/pom.xml
@@ -50,12 +50,10 @@
com.jayway.jsonpath
json-path
- 2.2.0
org.json
json
- ${json.utility.version}
io.mosip.kernel
@@ -87,7 +85,6 @@
org.springframework.boot
spring-boot-starter-web
- ${spring.boot.version}
com.fasterxml.jackson.core
@@ -99,7 +96,7 @@
org.springframework.kafka
spring-kafka
- 2.1.7.RELEASE
+ 2.5.8.RELEASE
@@ -126,12 +123,11 @@
org.tensorflow
tensorflow
- 1.12.0
+ 1.15.0
org.apache.httpcomponents
httpclient
- 4.5.9
org.apache.httpcomponents
@@ -142,32 +138,27 @@
org.apache.commons
commons-lang3
- 3.9
org.mockito
mockito-core
- ${mockito.version}
test
net.bytebuddy
byte-buddy
- ${byte-buddy.version}
compile
org.powermock
powermock-api-mockito2
- ${powermock.version}
test
org.powermock
powermock-module-junit4
- ${powermock.version}
test
@@ -235,19 +226,12 @@
org.springdoc
- springdoc-openapi-ui
+ springdoc-openapi-starter-webmvc-ui
${springdoc.version}
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
org.springframework.boot
spring-boot-starter-webflux
- ${spring.boot.version}
com.fasterxml.jackson.core
@@ -272,5 +256,9 @@
+
+ org.springframework.batch
+ spring-batch-infrastructure
+
diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImpl.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImpl.java
new file mode 100644
index 00000000000..89a53d79a1e
--- /dev/null
+++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImpl.java
@@ -0,0 +1,139 @@
+package io.mosip.authentication.childauthfilter.impl;
+
+import io.mosip.authentication.authfilter.exception.IdAuthenticationFilterException;
+import io.mosip.authentication.authfilter.spi.IMosipAuthFilter;
+import io.mosip.authentication.common.service.util.AuthTypeUtil;
+import io.mosip.authentication.core.constant.IdAuthCommonConstants;
+import io.mosip.authentication.core.constant.IdAuthenticationErrorConstants;
+import io.mosip.authentication.core.indauth.dto.AuthRequestDTO;
+import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO;
+import io.mosip.kernel.core.util.DateUtils;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * The Class ChildAuthFilterImpl - implementation of auth filter for
+ * validating AuthType locked/unlocked status for an individual in the
+ * authentication request.
+ *
+ * @author Kamesh Shekhar Prasad
+ */
+public class ChildAuthFilterImpl implements IMosipAuthFilter {
+
+
+ private static final String ERROR_MSG_UNSUPPORTED_AUTH_TYPE = "Unsupported Authentication Type for child - %s";
+
+ /** The Constant OTP. */
+ private static final String OTP = "otp";
+
+ /** The Constant DEMO. */
+ private static final String DEMO = "demo";
+
+ /** The Constant BIO. */
+ private static final String BIO = "bio";
+
+ /** The Constant DEFAULT_CHILD_MAX_AGE. */
+ private static final int DEFAULT_CHILD_MAX_AGE = 6;
+
+ /** The date of birth attribute name. */
+ @Value("${ida.child-auth-filter.date-of-birth.attribute.name:dateOfBirth}")
+ private String dateOfBirthAttributeName;
+
+ /** The date of birth pattern. */
+ @Value("${ida.child-auth-filter.date-of-birth.pattern:" + IdAuthCommonConstants.DEFAULT_DOB_PATTERN + "}")
+ private String dateOfBirthPattern;
+
+ /** The child max age. */
+ @Value("${ida.child-auth-filter.child.max.age:" + DEFAULT_CHILD_MAX_AGE + "}")
+ private int childMaxAge;
+
+ /** The factors denied for child. */
+ @Value("${ida.child-auth-filter.factors.denied:otp,bio}")
+ private String[] factorsDeniedForChild;
+
+ /**
+ * Initializes the filter.
+ *
+ * @throws IdAuthenticationFilterException the id authentication filter exception
+ */
+ public void init() throws IdAuthenticationFilterException {
+ }
+
+ /**
+ * Test method that executes predicate test condition on the given arguments.
+ *
+ * @param authRequest the auth request
+ * @param identityData the identity data
+ * @param properties the properties
+ * @throws IdAuthenticationFilterException the id authentication filter exception
+ */
+ public void validate(AuthRequestDTO authRequest, Map> identityData,
+ Map properties) throws IdAuthenticationFilterException {
+ LocalDate dob = getDateOfBirth(identityData.get(dateOfBirthAttributeName));
+ if(dob.plusYears(childMaxAge).isAfter(LocalDate.now())) {
+ checkDeniedFactorsForChild(authRequest);
+ }
+ }
+
+ /**
+ * Check denied factors for child.
+ *
+ * @param authRequest the auth request
+ * @throws IdAuthenticationFilterException the id authentication filter exception
+ */
+ private void checkDeniedFactorsForChild(AuthRequestDTO authRequest) throws IdAuthenticationFilterException{
+ List