From e5b23c30ed6de876656a16495a2660aa640dd114 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Wed, 9 Oct 2024 13:06:29 +0530 Subject: [PATCH 1/4] MOSIP-36413 Removed childauth filter Signed-off-by: kameshsr --- authentication/README.md | 1 + .../.gitignore | 1 - .../README.md | 1 + .../pom.xml | 298 ------------- .../impl/ChildAuthFilterImpl.java | 140 ------ .../impl/ChildAuthFilterImplTest.java | 273 ------------ authentication/pom.xml | 400 ------------------ 7 files changed, 2 insertions(+), 1112 deletions(-) create mode 100644 authentication/README.md delete mode 100644 authentication/authentication-childauthfilter-impl/.gitignore create mode 100644 authentication/authentication-childauthfilter-impl/README.md delete mode 100644 authentication/authentication-childauthfilter-impl/pom.xml delete mode 100644 authentication/authentication-childauthfilter-impl/src/main/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImpl.java delete mode 100644 authentication/authentication-childauthfilter-impl/src/test/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImplTest.java delete mode 100644 authentication/pom.xml diff --git a/authentication/README.md b/authentication/README.md new file mode 100644 index 00000000000..031e627aabf --- /dev/null +++ b/authentication/README.md @@ -0,0 +1 @@ +# This repo is moved to [Id-authentication](https://github.com/mosip/id-authentication/tree/develop) as part of https://mosip.atlassian.net/browse/MOSIP-36413 \ No newline at end of file diff --git a/authentication/authentication-childauthfilter-impl/.gitignore b/authentication/authentication-childauthfilter-impl/.gitignore deleted file mode 100644 index dda8d3ed9de..00000000000 --- a/authentication/authentication-childauthfilter-impl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -logs/** diff --git a/authentication/authentication-childauthfilter-impl/README.md b/authentication/authentication-childauthfilter-impl/README.md new file mode 100644 index 00000000000..031e627aabf --- /dev/null +++ b/authentication/authentication-childauthfilter-impl/README.md @@ -0,0 +1 @@ +# This repo is moved to [Id-authentication](https://github.com/mosip/id-authentication/tree/develop) as part of https://mosip.atlassian.net/browse/MOSIP-36413 \ No newline at end of file diff --git a/authentication/authentication-childauthfilter-impl/pom.xml b/authentication/authentication-childauthfilter-impl/pom.xml deleted file mode 100644 index c3c7d628ab1..00000000000 --- a/authentication/authentication-childauthfilter-impl/pom.xml +++ /dev/null @@ -1,298 +0,0 @@ - - 4.0.0 - - io.mosip.authentication - authentication-ref-impl-parent - 1.2.1-SNAPSHOT - - 1.2.1-SNAPSHOT - authentication-childauthfilter-impl - authentication-childauthfilter-impl - ID Authentication Filter reference Implementation to check allowed auth types for child - https://github.com/mosip/commons - jar - - - UTF-8 - - - 21 - 21 - 3.8.0 - - 3.0.2 - 3.1.0 - 3.2.0 - 2.3 - - - - - - - io.mosip.kernel - kernel-bom - 1.2.1-SNAPSHOT - pom - import - - - - - - - org.projectlombok - lombok - compile - - - io.mosip.kernel - kernel-core - ${kernel-core.version} - - - org.springframework.boot - - spring-boot-starter-security - - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.core - jackson-core - - - com.fasterxml.jackson.core - jackson-annotations - - - - - io.mosip.authentication - authentication-core - ${authentication-core.version} - - - com.fasterxml.jackson.core - jackson-core - - - com.fasterxml.jackson.core - jackson-annotations - - - - - io.mosip.authentication - authentication-common - ${authentication-common.version} - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-core - - - - - io.mosip.authentication - authentication-filter-api - ${authentication-filter-api.version} - - - io.mosip.kernel - kernel-logger-logback - ${kernel-logger-logback.version} - - - org.springframework.boot - - spring-boot-starter-security - - - - com.fasterxml.jackson.core - jackson-databind - - - - - org.springframework.boot - spring-boot-starter-webflux - ${spring.boot.version} - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.core - jackson-core - - - - - io.springfox - springfox-swagger2 - ${maven.swagger.version} - - - com.fasterxml.jackson.core - jackson-annotations - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - maven-deploy-plugin - 2.8.1 - - - default-deploy - deploy - - deploy - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - - default-deploy - deploy - - deploy - - - - - ossrh - https://oss.sonatype.org/ - false - - - - - org.apache.maven.plugins - maven-source-plugin - true - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - - - - - none - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - pl.project13.maven - git-commit-id-plugin - 3.0.1 - - - get-the-git-infos - - revision - - validate - - - - true - ${project.build.outputDirectory}/git.properties - - ^git.build.(time|version)$ - ^git.commit.id.(abbrev|full)$ - - full - ${project.basedir}/.git - - - - - - - scm:git:git://github.com/mosip/commons.git - scm:git:ssh://github.com:mosip/commons.git - https://github.com/mosip/commons - HEAD - - - - MPL 2.0 - https://www.mozilla.org/en-US/MPL/2.0/ - - - - - Mosip - mosip.emailnotifier@gmail.com - io.mosip - https://github.com/mosip/commons - - - - diff --git a/authentication/authentication-childauthfilter-impl/src/main/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImpl.java b/authentication/authentication-childauthfilter-impl/src/main/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImpl.java deleted file mode 100644 index 95cbd322439..00000000000 --- a/authentication/authentication-childauthfilter-impl/src/main/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -package io.mosip.authentication.childauthfilter.impl; - -import java.time.LocalDate; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.springframework.beans.factory.annotation.Value; - -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; - -/** - * The Class ChildAuthFilterImpl - implementation of auth filter for - * validating AuthType locked/unlocked status for an individual in the - * authentication request. - * - * @author Loganathan Sekar - */ -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 deniedFactors = Stream.of(factorsDeniedForChild) - .map(String::toLowerCase) - .collect(Collectors.toList()); - if(deniedFactors.contains(OTP) && AuthTypeUtil.isOtp(authRequest)) { - throw new IdAuthenticationFilterException( - IdAuthenticationErrorConstants.AUTH_TYPE_NOT_SUPPORTED.getErrorCode(), - String.format(ERROR_MSG_UNSUPPORTED_AUTH_TYPE, OTP)); - } - - if(deniedFactors.contains(DEMO) && AuthTypeUtil.isDemo(authRequest)) { - throw new IdAuthenticationFilterException( - IdAuthenticationErrorConstants.AUTH_TYPE_NOT_SUPPORTED.getErrorCode(), - String.format(ERROR_MSG_UNSUPPORTED_AUTH_TYPE, DEMO)); - } - - if(deniedFactors.contains(BIO) && AuthTypeUtil.isBio(authRequest)) { - throw new IdAuthenticationFilterException( - IdAuthenticationErrorConstants.AUTH_TYPE_NOT_SUPPORTED.getErrorCode(), - String.format(ERROR_MSG_UNSUPPORTED_AUTH_TYPE, BIO)); - } - - } - - /** - * Gets the date of birth. - * - * @param dobData the dob data - * @return the date of birth - * @throws IdAuthenticationFilterException the id authentication filter exception - */ - private LocalDate getDateOfBirth(List dobData) throws IdAuthenticationFilterException { - if(dobData == null || dobData.isEmpty()) { - throw new IdAuthenticationFilterException(IdAuthenticationErrorConstants.ID_NOT_AVAILABLE.getErrorCode(), String.format(IdAuthenticationErrorConstants.ID_NOT_AVAILABLE.getErrorMessage(), dateOfBirthAttributeName)); - } - - IdentityInfoDTO identityInfoDTO = dobData.get(0); - String dob = identityInfoDTO.getValue(); - - if(dob == null || dob.trim().isEmpty()) { - throw new IdAuthenticationFilterException(IdAuthenticationErrorConstants.ID_NOT_AVAILABLE.getErrorCode(), String.format(IdAuthenticationErrorConstants.ID_NOT_AVAILABLE.getErrorMessage(), dateOfBirthAttributeName)); - } - - try { - return DateUtils.parseDateToLocalDateTime(DateUtils.parseToDate(dob, dateOfBirthPattern)).toLocalDate(); - } catch (Exception e) { - throw new IdAuthenticationFilterException(IdAuthenticationErrorConstants.UNABLE_TO_PROCESS.getErrorCode(), "Request could not be processed. Unable to parse " + dateOfBirthAttributeName + " from DB."); - } - } - -} diff --git a/authentication/authentication-childauthfilter-impl/src/test/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImplTest.java b/authentication/authentication-childauthfilter-impl/src/test/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImplTest.java deleted file mode 100644 index 3bd8cd2afd7..00000000000 --- a/authentication/authentication-childauthfilter-impl/src/test/java/io/mosip/authentication/childauthfilter/impl/ChildAuthFilterImplTest.java +++ /dev/null @@ -1,273 +0,0 @@ -package io.mosip.authentication.childauthfilter.impl; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.springframework.test.util.ReflectionTestUtils; - -import io.mosip.authentication.authfilter.exception.IdAuthenticationFilterException; -import io.mosip.authentication.core.constant.IdAuthCommonConstants; -import io.mosip.authentication.core.indauth.dto.AuthRequestDTO; -import io.mosip.authentication.core.indauth.dto.BioIdentityInfoDTO; -import io.mosip.authentication.core.indauth.dto.DataDTO; -import io.mosip.authentication.core.indauth.dto.IdentityDTO; -import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO; -import io.mosip.authentication.core.indauth.dto.RequestDTO; - -/** - * @author Loganathan Sekar - * - */ -public class ChildAuthFilterImplTest { - - private static final String DOB_PATTERN = IdAuthCommonConstants.DEFAULT_DOB_PATTERN; - private static final int CHILD_MAX_AGE_TEST = 6; - private static final String DATE_OF_BIRTH_ATTRIB_NAME = "dateOfBirth"; - private ChildAuthFilterImpl childAuthFilterImpl = new ChildAuthFilterImpl(); - - @Before - public void before() { - ReflectionTestUtils.setField(childAuthFilterImpl, "dateOfBirthAttributeName", DATE_OF_BIRTH_ATTRIB_NAME); - ReflectionTestUtils.setField(childAuthFilterImpl, "dateOfBirthPattern", IdAuthCommonConstants.DEFAULT_DOB_PATTERN); - ReflectionTestUtils.setField(childAuthFilterImpl, "childMaxAge", CHILD_MAX_AGE_TEST); - ReflectionTestUtils.setField(childAuthFilterImpl, "factorsDeniedForChild", new String[] {"otp", "bio"}); - } - - @Test - public void testInit() throws IdAuthenticationFilterException { - childAuthFilterImpl.init(); - } - - @Test - public void testValidDateOfBirth() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(8).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidChildDateOfBirth_OTP() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - RequestDTO request = new RequestDTO(); - request.setOtp("12345"); - req.setRequest(request); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(4).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test - public void testValidChildDateOfBirth_OTP_Allowed() throws IdAuthenticationFilterException { - ReflectionTestUtils.setField(childAuthFilterImpl, "factorsDeniedForChild", new String[] {"bio", "demo"}); - AuthRequestDTO req = new AuthRequestDTO(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(4).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidChildDateOfBirth_BIO() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - RequestDTO request = new RequestDTO(); - List list = new ArrayList<>(); - BioIdentityInfoDTO bioData = new BioIdentityInfoDTO(); - DataDTO data = new DataDTO(); - data.setBioType("Finger"); - data.setBioSubType("UNKNOWN"); - bioData.setData(data); - list.add(bioData); - request.setBiometrics(list); - req.setRequest(request); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(4).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test - public void testValidChildDateOfBirth_BIO_Allowed() throws IdAuthenticationFilterException { - ReflectionTestUtils.setField(childAuthFilterImpl, "factorsDeniedForChild", new String[] {"demo", "otp"}); - AuthRequestDTO req = new AuthRequestDTO(); - RequestDTO request = new RequestDTO(); - List list = new ArrayList<>(); - BioIdentityInfoDTO bioData = new BioIdentityInfoDTO(); - DataDTO data = new DataDTO(); - data.setBioType("Finger"); - data.setBioSubType("UNKNOWN"); - bioData.setData(data); - list.add(bioData); - request.setBiometrics(list); - req.setRequest(request); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(4).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidChildDateOfBirth_Demo() throws IdAuthenticationFilterException { - ReflectionTestUtils.setField(childAuthFilterImpl, "factorsDeniedForChild", new String[] {"demo", "bio"}); - - AuthRequestDTO req = new AuthRequestDTO(); - RequestDTO request = new RequestDTO(); - IdentityDTO identityDto = new IdentityDTO(); - identityDto.setEmailId("aaa@bbb.ccc"); - request.setDemographics(identityDto); - req.setRequest(request); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(4).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test - public void testValidChildDateOfBirth_Demo_NotAlowed() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(4).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test - public void testValidChildDateOfBirth_Bio_BorderCase_exact() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(CHILD_MAX_AGE_TEST).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidChildDateOfBirth_Bio_BorderCase_1day_less() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - RequestDTO request = new RequestDTO(); - List list = new ArrayList<>(); - BioIdentityInfoDTO bioData = new BioIdentityInfoDTO(); - DataDTO data = new DataDTO(); - data.setBioType("Finger"); - data.setBioSubType("UNKNOWN"); - bioData.setData(data); - list.add(bioData); - request.setBiometrics(list); - req.setRequest(request); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(CHILD_MAX_AGE_TEST).plusDays(1).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test - public void testValidChildDateOfBirth_Bio_BorderCase_1day_more() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().minusYears(CHILD_MAX_AGE_TEST).minusDays(1).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidChildDateOfBirth_Bio_FutureDate() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - RequestDTO request = new RequestDTO(); - List list = new ArrayList<>(); - BioIdentityInfoDTO bioData = new BioIdentityInfoDTO(); - DataDTO data = new DataDTO(); - data.setBioType("Finger"); - data.setBioSubType("UNKNOWN"); - bioData.setData(data); - list.add(bioData); - request.setBiometrics(list); - req.setRequest(request); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DOB_PATTERN); - String dob = LocalDate.now().plusYears(1).plusDays(1).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidInvalidDOB() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM-dd-yyyy"); - String dob = LocalDate.now().minusYears(8).format(formatter ); - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidEmptyDOB() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - String dob = ""; - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidNullDOB() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - String dob = null; - IdentityInfoDTO identityInfoDTO = new IdentityInfoDTO(); - identityInfoDTO.setValue(dob); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of(identityInfoDTO)); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidEmptyDOBData() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - Map> identityData = Map.of(DATE_OF_BIRTH_ATTRIB_NAME, List.of()); - childAuthFilterImpl.validate(req, identityData, null); - } - - @Test(expected = IdAuthenticationFilterException.class) - public void testValidNullDOBData() throws IdAuthenticationFilterException { - AuthRequestDTO req = new AuthRequestDTO(); - Map> identityData = new HashMap<>(); - identityData.put(DATE_OF_BIRTH_ATTRIB_NAME, null); - childAuthFilterImpl.validate(req, identityData, null); - } - - -} diff --git a/authentication/pom.xml b/authentication/pom.xml deleted file mode 100644 index 98d9dfd8abf..00000000000 --- a/authentication/pom.xml +++ /dev/null @@ -1,400 +0,0 @@ - - - 4.0.0 - - io.mosip.authentication - authentication-ref-impl-parent - 1.2.1-SNAPSHOT - pom - - id-authentication Reference Impl Parent - Parent project of MOSIP ID Authentication Referernce Implementation components - https://github.com/mosip/id-authentication - - - - MPL 2.0 - https://www.mozilla.org/en-US/MPL/2.0/ - - - - - scm:git:git://github.com/mosip/id-authentication.git - scm:git:ssh://github.com:mosip/id-authentication.git - https://github.com/mosip/id-authentication - HEAD - - - - - Mosip - mosip.emailnotifier@gmail.com - io.mosip - https://github.com/mosip/id-authentication - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - ossrh - Central Repository - https://oss.sonatype.org/content/repositories/snapshots - default - - true - - - - - authentication-childauthfilter-impl - - - - ${project.version} - ${authentication.parent.version} - ${authentication.parent.version} - ${authentication.parent.version} - UTF-8 - - - 1.2.1-SNAPSHOT - ${kernel.parent.version} - ${kernel.parent.version} - - - 21 - 21 - 3.8.0 - 3.2.0 - 2.10.0 - 0.8.11 - 3.7.0.1746 - 2.22.0 - - - 1.9.3 - - - 3.2.5 - 4.0.1.RELEASE - 5.0.5.RELEASE - 2.0.0.RELEASE - - 2.0.1.Final - 6.0.12.Final - 2.9.5 - 42.2.2 - - - 3.7 - 1.11 - - 3.4.0 - - **/test/**/*.* - **/ai/**/*.*,**/jdbc/**/*.*,**/mpt/**/*.*,**/jcr/**/*.*,**/JDBC*,**/constant/**,**/config/**,**/dto/**,**io/mosip/authentication/common/service/filter/**,**io/mosip/authentication/service/filter/**,**io/mosip/authentication/otp/service/filter/**,**io/mosip/authentication/common/policy/**,**io/mosip/authentication/internal/service/filter/**,**io/mosip/authentication/kyc/service/filter/**,**io/mosip/authentication/staticpin/service/filter/**,**io/mosip/authentication/common/service/entity/**,**/service/IdAuthenticationApplication.java,**/service/**/*Entity.java,**internal/service/InternalAuthenticationApplication.java,**kyc/service/KycAuthenticationApplication.java,**spin/service/StaticPinAuthenticationApplication.java,**io/mosip/authentication/common/service/repository/**,**authentication/otp/service/OtpApplication.java,**authentication/staticpin/service/StaticPinApplication.java,**/authentication/vid/service/VidApplication.java,**/authentication/core/spi/indauth/match/** - - 3.0.2 - 3.1.0 - - 3.1 - - - - - - io.mosip.kernel - kernel-bom - 1.2.1-SNAPSHOT - pom - import - - - - - - - - junit - junit - test - - - - org.projectlombok - lombok - compile - - - - io.springfox - springfox-swagger2 - ${maven.swagger.version} - - - io.springfox - springfox-swagger-ui - ${maven.swagger.version} - - - - org.springframework.boot - spring-boot-starter-webflux - - - javax.xml.bind - jaxb-api - - - org.javassist - javassist - - - - io.mosip.kernel - kernel-logger-logback - ${kernel-logger-logback.version} - - - org.springframework.boot - - spring-boot-starter-security - - - - - - - io.mosip.kernel - kernel-core - ${kernel-core.version} - - - org.springframework.boot - - spring-boot-starter-security - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven.compiler.version} - - ${maven.compiler.source} - ${maven.compiler.target} - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - attach-javadocs - - jar - - - - - none - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://oss.sonatype.org/ - false - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - org.jacoco - jacoco-maven-plugin - ${maven.jacoco.version} - - - **/constant/** - **/config/** - **/dto/** - io/mosip/authentication/service/*.class - io/mosip/authentication/service/filter/** - - - - - - prepare-agent - - - - report - prepare-package - - report - - - - - - org.apache.maven.plugins - maven-jar-plugin - ${maven.jar.plugin.version} - - - - true - true - - - ${project.name} - ${project.version} - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven.war.plugin.version} - - - - true - true - - - ${project.name} - ${project.version} - - - - - - pl.project13.maven - git-commit-id-plugin - 3.0.1 - - - get-the-git-infos - - revision - - validate - - - - true - ${project.build.outputDirectory}/git.properties - - ^git.build.(time|version)$ - ^git.commit.id.(abbrev|full)$ - - full - ${project.basedir}/.git - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven.surefire.plugin.version} - - ${skipTests} - false - - ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --illegal-access=permit - - - - - - - - - - - sonar - - - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${maven.sonar.version} - - - verify - - sonar - - - - - - - - - - From da386d79a7ad564daa39ae4fba84fd545c2b9790 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Wed, 9 Oct 2024 13:09:40 +0530 Subject: [PATCH 2/4] MOSIP-36413 Removed childauth filter Signed-off-by: kameshsr --- .github/workflows/push-trigger.yml | 40 ------------------------------ 1 file changed, 40 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index c0746fafafb..be86a594f45 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -235,44 +235,4 @@ jobs: OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} GPG_SECRET: ${{ secrets.GPG_SECRET }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - build-maven-authentication-ref-impl: - uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21 - with: - SERVICE_LOCATION: authentication - BUILD_ARTIFACT: authentication - secrets: - OSSRH_USER: ${{ secrets.OSSRH_USER }} - OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} - OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} - GPG_SECRET: ${{ secrets.GPG_SECRET }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - publish_to_nexus_authentication-ref-impl: - if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' }}" - needs: build-maven-authentication-ref-impl - uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21 - with: - SERVICE_LOCATION: authentication - secrets: - OSSRH_USER: ${{ secrets.OSSRH_USER }} - OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} - OSSRH_URL: ${{ secrets.OSSRH_SNAPSHOT_URL }} - OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} - GPG_SECRET: ${{ secrets.GPG_SECRET }} - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - sonar_analysis_authentication-ref-impl: - needs: build-maven-authentication-ref-impl - if: "${{ github.event_name != 'pull_request' }}" - uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21 - with: - SERVICE_LOCATION: authentication - PROJECT_KEY: mosip_biosdk-client - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - ORG_KEY: ${{ secrets.ORG_KEY }} - OSSRH_USER: ${{ secrets.OSSRH_USER }} - OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }} - OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} - GPG_SECRET: ${{ secrets.GPG_SECRET }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} \ No newline at end of file From 6359c1cb508828f69d09a8e7985dbd5fc261b68e Mon Sep 17 00:00:00 2001 From: kameshsr Date: Wed, 9 Oct 2024 16:04:21 +0530 Subject: [PATCH 3/4] MOSIP-36413 Updated readme Signed-off-by: kameshsr --- authentication/README.md | 2 +- authentication/authentication-childauthfilter-impl/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authentication/README.md b/authentication/README.md index 031e627aabf..3a8e71e18b3 100644 --- a/authentication/README.md +++ b/authentication/README.md @@ -1 +1 @@ -# This repo is moved to [Id-authentication](https://github.com/mosip/id-authentication/tree/develop) as part of https://mosip.atlassian.net/browse/MOSIP-36413 \ No newline at end of file +This file is moved to id-authentication repo and placed under the authentication-internal-service. \ No newline at end of file diff --git a/authentication/authentication-childauthfilter-impl/README.md b/authentication/authentication-childauthfilter-impl/README.md index 031e627aabf..3a8e71e18b3 100644 --- a/authentication/authentication-childauthfilter-impl/README.md +++ b/authentication/authentication-childauthfilter-impl/README.md @@ -1 +1 @@ -# This repo is moved to [Id-authentication](https://github.com/mosip/id-authentication/tree/develop) as part of https://mosip.atlassian.net/browse/MOSIP-36413 \ No newline at end of file +This file is moved to id-authentication repo and placed under the authentication-internal-service. \ No newline at end of file From de695165616000f4545cc54bfa8cabed4fc0f3f8 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Wed, 9 Oct 2024 16:16:11 +0530 Subject: [PATCH 4/4] MOSIP-36413 Updated readme Signed-off-by: kameshsr --- authentication/README.md | 2 +- authentication/authentication-childauthfilter-impl/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authentication/README.md b/authentication/README.md index 3a8e71e18b3..98c1b0ef7de 100644 --- a/authentication/README.md +++ b/authentication/README.md @@ -1 +1 @@ -This file is moved to id-authentication repo and placed under the authentication-internal-service. \ No newline at end of file +This code is moved to id-authentication repo and placed under the authentication-internal-service. \ No newline at end of file diff --git a/authentication/authentication-childauthfilter-impl/README.md b/authentication/authentication-childauthfilter-impl/README.md index 3a8e71e18b3..98c1b0ef7de 100644 --- a/authentication/authentication-childauthfilter-impl/README.md +++ b/authentication/authentication-childauthfilter-impl/README.md @@ -1 +1 @@ -This file is moved to id-authentication repo and placed under the authentication-internal-service. \ No newline at end of file +This code is moved to id-authentication repo and placed under the authentication-internal-service. \ No newline at end of file