diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/config/IDAMappingConfig.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/config/IDAMappingConfig.java index b2f00b47101..3117ec4c3fc 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/config/IDAMappingConfig.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/config/IDAMappingConfig.java @@ -126,4 +126,7 @@ public class IDAMappingConfig implements MappingConfig { /** The dynamic attributes. */ private Map> dynamicAttributes; + /** The password. */ + private List password; + } diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/facade/AuthFacadeImpl.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/facade/AuthFacadeImpl.java index e215a10e3a8..c95f38bea78 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/facade/AuthFacadeImpl.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/facade/AuthFacadeImpl.java @@ -29,6 +29,7 @@ import io.mosip.authentication.common.service.helper.AuditHelper; import io.mosip.authentication.common.service.helper.AuthTransactionHelper; import io.mosip.authentication.common.service.helper.IdInfoHelper; +import io.mosip.authentication.common.service.impl.match.IdaIdMapping; import io.mosip.authentication.common.service.integration.TokenIdManager; import io.mosip.authentication.common.service.transaction.manager.IdAuthSecurityManager; import io.mosip.authentication.common.service.util.AuthTypeUtil; @@ -47,6 +48,7 @@ import io.mosip.authentication.core.indauth.dto.AuthStatusInfo; import io.mosip.authentication.core.indauth.dto.IdType; import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO; +import io.mosip.authentication.core.indauth.dto.KycAuthRequestDTO; import io.mosip.authentication.core.indauth.dto.EkycAuthRequestDTO; import io.mosip.authentication.core.logger.IdaLogger; import io.mosip.authentication.core.partner.dto.PartnerPolicyResponseDTO; @@ -58,6 +60,7 @@ import io.mosip.authentication.core.spi.indauth.service.BioAuthService; import io.mosip.authentication.core.spi.indauth.service.DemoAuthService; import io.mosip.authentication.core.spi.indauth.service.OTPAuthService; +import io.mosip.authentication.core.spi.indauth.service.PasswordAuthService; import io.mosip.authentication.core.spi.notification.service.NotificationService; import io.mosip.authentication.core.spi.partner.service.PartnerService; import io.mosip.kernel.core.logger.spi.Logger; @@ -129,6 +132,9 @@ public class AuthFacadeImpl implements AuthFacade { @Autowired private KeyBindedTokenAuthService keyBindedTokenAuthService; + + @Autowired + private PasswordAuthService passwordAuthService; /* * (non-Javadoc) @@ -161,6 +167,14 @@ public AuthResponseDTO authenticateIndividual(AuthRequestDTO authRequestDTO, boo addKycPolicyAttributes(filterAttributes, kycAuthRequestDTO); } + + if(authRequestDTO instanceof KycAuthRequestDTO) { + KycAuthRequestDTO kycAuthRequestDTO = (KycAuthRequestDTO) authRequestDTO; + // In case of kyc-auth request and password auth is requested + if(AuthTypeUtil.isPassword(kycAuthRequestDTO)) { + filterAttributes.add(IdaIdMapping.PASSWORD.getIdname()); + } + } Map idResDTO = idService.processIdType(idvIdType, idvid, idInfoHelper.isBiometricDataNeeded(authRequestDTO), markVidConsumed, filterAttributes); @@ -312,6 +326,11 @@ private List processAuthType(AuthRequestDTO authRequestDTO, authTxnBuilder, idvidHash); } + if (!isMatchFailed(authStatusList)) { + processPasswordAuth(authRequestDTO, idInfo, token, isAuth, authStatusList, idType, authTokenId, partnerId, + authTxnBuilder, idvidHash); + } + return authStatusList; } @@ -513,5 +532,39 @@ private void processTokenAuth(AuthRequestDTO authRequestDTO, Map> idInfo, String token, + boolean isAuth, List authStatusList, IdType idType, String authTokenId, String partnerId, + AuthTransactionBuilder authTxnBuilder, String idvidHash) throws IdAuthenticationBusinessException { + if (AuthTypeUtil.isPassword(authRequestDTO)) { + AuthStatusInfo passwordMatchStatus = null; + try { + passwordMatchStatus = passwordAuthService.authenticate(authRequestDTO, token, idInfo, partnerId); + authStatusList.add(passwordMatchStatus); + + boolean isStatus = passwordMatchStatus != null && passwordMatchStatus.isStatus(); + auditHelper.audit(AuditModules.PASSWORD_AUTH, AuditEvents.PASSWORD_BASED_AUTH_REQUEST, idvidHash, + idType, "authenticateApplicant status(Password) : " + isStatus); + } finally { + boolean isStatus = passwordMatchStatus != null && passwordMatchStatus.isStatus(); + logger.info(IdAuthCommonConstants.SESSION_ID, EnvUtil.getAppId(), + AUTH_FACADE, "Password Authentication status : " + isStatus); + authTxnBuilder.addRequestType(RequestType.PASSWORD_AUTH); + } + } + } } \ No newline at end of file diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java index a8d5e2bc73f..9796bed5cff 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java @@ -28,6 +28,8 @@ import javax.servlet.ServletException; import io.mosip.authentication.core.indauth.dto.KeyBindedTokenDTO; +import io.mosip.authentication.core.indauth.dto.KycAuthRequestDTO; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -843,6 +845,7 @@ protected void checkAllowedAuthTypeForKeyBindedToken(Map request Object value = Optional.ofNullable(requestBody.get(IdAuthCommonConstants.REQUEST)) .filter(obj -> obj instanceof Map).map(obj -> ((Map) obj).get(KEY_BINDED_TOKEN)) .filter(obj -> obj instanceof List).orElse(Collections.emptyMap()); + List list = mapper.readValue(mapper.writeValueAsBytes(value), new TypeReference>() { }); @@ -861,6 +864,19 @@ protected void checkAllowedAuthTypeForKeyBindedToken(Map request } } + protected void checkAllowedAuthTypeForPassword(Map requestBody, List authPolicies) + throws IdAuthenticationAppException, IOException { + KycAuthRequestDTO authRequestDTO = mapper.readValue(mapper.writeValueAsBytes(requestBody), + KycAuthRequestDTO.class); + + if (AuthTypeUtil.isPassword(authRequestDTO) && !isAllowedAuthType(MatchType.Category.PASSWORD.getType(), authPolicies)) { + throw new IdAuthenticationAppException( + IdAuthenticationErrorConstants.AUTHTYPE_NOT_ALLOWED.getErrorCode(), + String.format(IdAuthenticationErrorConstants.AUTHTYPE_NOT_ALLOWED.getErrorMessage(), + MatchType.Category.PASSWORD.name())); + } + } + /** * Check allowed auth type for bio. * diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/helper/IdInfoHelper.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/helper/IdInfoHelper.java index c7293860059..bd19c5cf457 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/helper/IdInfoHelper.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/helper/IdInfoHelper.java @@ -535,6 +535,12 @@ private Map getEntityInfo(Map> idE IdAuthenticationErrorConstants.KEY_BINDING_MISSING.getErrorCode(), String.format(IdAuthenticationErrorConstants.KEY_BINDING_MISSING.getErrorMessage(), input.getAuthType().getType())); + + case PASSWORD: + throw new IdAuthenticationBusinessException( + IdAuthenticationErrorConstants.PASSWORD_MISSING.getErrorCode(), + String.format(IdAuthenticationErrorConstants.PASSWORD_MISSING.getErrorMessage(), + input.getAuthType().getType())); } } return entityInfo; diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/IdInfoFetcherImpl.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/IdInfoFetcherImpl.java index be8c0aa7aea..cdebdf68e2c 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/IdInfoFetcherImpl.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/IdInfoFetcherImpl.java @@ -26,6 +26,7 @@ import io.mosip.authentication.common.service.impl.match.IdaIdMapping; import io.mosip.authentication.common.service.integration.MasterDataManager; import io.mosip.authentication.common.service.integration.OTPManager; +import io.mosip.authentication.common.service.integration.PasswordComparator; import io.mosip.authentication.common.service.util.BioMatcherUtil; import io.mosip.authentication.common.service.util.EnvUtil; import io.mosip.authentication.core.constant.IdAuthCommonConstants; @@ -37,6 +38,7 @@ import io.mosip.authentication.core.indauth.dto.RequestDTO; import io.mosip.authentication.core.spi.bioauth.CbeffDocType; import io.mosip.authentication.core.spi.indauth.match.AuthType; +import io.mosip.authentication.core.spi.indauth.match.ComparePasswordFunction; import io.mosip.authentication.core.spi.indauth.match.IdInfoFetcher; import io.mosip.authentication.core.spi.indauth.match.IdMapping; import io.mosip.authentication.core.spi.indauth.match.MappingConfig; @@ -96,6 +98,9 @@ public class IdInfoFetcherImpl implements IdInfoFetcher { @Autowired(required = false) private KeyBindedTokenMatcherUtil keyBindedTokenMatcherUtil; + + @Autowired(required = false) + private PasswordComparator passwordComparator; /** * Gets the demo normalizer. @@ -572,4 +577,15 @@ public List getUserPreferredLanguages(Map> } return Collections.emptyList(); } + + /* + * Get Match password Function + * + * @see io.mosip.authentication.core.spi.indauth.match.IdInfoFetcher# + * getMatchPasswordFunction() + */ + @Override + public ComparePasswordFunction getMatchPasswordFunction() { + return passwordComparator::matchPasswordFunction; + } } diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/PasswordAuthServiceImpl.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/PasswordAuthServiceImpl.java new file mode 100644 index 00000000000..d337d55c482 --- /dev/null +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/PasswordAuthServiceImpl.java @@ -0,0 +1,70 @@ +package io.mosip.authentication.common.service.impl; + +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import io.mosip.authentication.common.service.builder.AuthStatusInfoBuilder; +import io.mosip.authentication.common.service.builder.MatchInputBuilder; +import io.mosip.authentication.common.service.config.IDAMappingConfig; +import io.mosip.authentication.common.service.helper.IdInfoHelper; +import io.mosip.authentication.common.service.impl.match.PasswordAuthType; +import io.mosip.authentication.common.service.impl.match.PasswordMatchType; +import io.mosip.authentication.core.constant.IdAuthenticationErrorConstants; +import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; +import io.mosip.authentication.core.indauth.dto.AuthRequestDTO; +import io.mosip.authentication.core.indauth.dto.AuthStatusInfo; +import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO; +import io.mosip.authentication.core.spi.indauth.match.MatchInput; +import io.mosip.authentication.core.spi.indauth.match.MatchOutput; +import io.mosip.authentication.core.spi.indauth.service.PasswordAuthService; +import lombok.NoArgsConstructor; + +@Service +@NoArgsConstructor +public class PasswordAuthServiceImpl implements PasswordAuthService { + + @Autowired + private IdInfoHelper idInfoHelper; + + /** The id info helper. */ + @Autowired + private MatchInputBuilder matchInputBuilder; + + /** The ida mapping config. */ + @Autowired + private IDAMappingConfig idaMappingConfig; + + public AuthStatusInfo authenticate(AuthRequestDTO authRequestDTO,String individualId, + Map> idInfo,String partnerId) + throws IdAuthenticationBusinessException { + + if (idInfo == null || idInfo.isEmpty()) { + throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.SERVER_ERROR); + } + + List listMatchInputs = constructMatchInput(authRequestDTO, idInfo); + + List listMatchOutputs = constructMatchOutput(authRequestDTO, listMatchInputs, idInfo, + partnerId); + // Using AND condition on the match output for Bio auth. + boolean isMatched = !listMatchOutputs.isEmpty() && listMatchOutputs.stream().allMatch(MatchOutput::isMatched); + return AuthStatusInfoBuilder.buildStatusInfo(isMatched, listMatchInputs, listMatchOutputs, + PasswordAuthType.values(), idaMappingConfig); + + } + + public List constructMatchInput(AuthRequestDTO authRequestDTO, + Map> idInfo) { + return matchInputBuilder.buildMatchInput(authRequestDTO, PasswordAuthType.values(), PasswordMatchType.values(), + idInfo); + } + + private List constructMatchOutput(AuthRequestDTO authRequestDTO, List listMatchInputs, + Map> idInfo, String partnerId) + throws IdAuthenticationBusinessException { + return idInfoHelper.matchIdentityData(authRequestDTO, idInfo, listMatchInputs, partnerId); + } +} diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/IdaIdMapping.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/IdaIdMapping.java index 789171e659b..4e3ccd80650 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/IdaIdMapping.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/IdaIdMapping.java @@ -177,13 +177,14 @@ public String getSubType() { RIGHTIRIS, LEFTIRIS, UNKNOWN_IRIS, FACE,UNKNOWN_FACE), "DummyType"), - KEY_BINDED_TOKENS("keyBindedTokens"){ public BiFunction> getMappingFunction() { return (mappingConfig, matchType) -> { return Collections.emptyList(); }; } }, + PASSWORD("password", MappingConfig::getPassword), + /** The dynamic demographics ID Mapping. */ DYNAMIC("demographics") { diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordAuthType.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordAuthType.java new file mode 100644 index 00000000000..5c301684adf --- /dev/null +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordAuthType.java @@ -0,0 +1,57 @@ +package io.mosip.authentication.common.service.impl.match; + +import io.mosip.authentication.common.service.impl.AuthTypeImpl; +import io.mosip.authentication.core.indauth.dto.AuthRequestDTO; +import io.mosip.authentication.core.indauth.dto.KycAuthRequestDTO; +import io.mosip.authentication.core.spi.indauth.match.AuthType; +import io.mosip.authentication.core.spi.indauth.match.ComparePasswordFunction; +import io.mosip.authentication.core.spi.indauth.match.IdInfoFetcher; +import io.mosip.authentication.core.spi.indauth.match.MatchType; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +public enum PasswordAuthType implements AuthType { + + PASSWORD(IdaIdMapping.PASSWORD.getIdname(), AuthType.setOf(PasswordMatchType.PASSWORD), "PASSWORD"); + + private AuthTypeImpl authTypeImpl; + + /** + * Instantiates a new demo auth type. + * + * @param type the type + * @param associatedMatchTypes the associated match types + */ + private PasswordAuthType(String type, Set associatedMatchTypes, String displayName) { + authTypeImpl = new AuthTypeImpl(type, associatedMatchTypes, displayName); + } + + + @Override + public boolean isAuthTypeInfoAvailable(AuthRequestDTO authRequestDTO) { + if(authRequestDTO instanceof KycAuthRequestDTO) { + KycAuthRequestDTO kycAuthRequestDTO = (KycAuthRequestDTO) authRequestDTO; + return Objects.nonNull(kycAuthRequestDTO.getRequest().getPassword()); + } + return false; + } + + @Override + public Map getMatchProperties(AuthRequestDTO authRequestDTO, IdInfoFetcher idInfoFetcher, + String language) { + Map valueMap = new HashMap<>(); + if(isAuthTypeInfoAvailable(authRequestDTO)) { + ComparePasswordFunction func = idInfoFetcher.getMatchPasswordFunction(); + valueMap.put(IdaIdMapping.PASSWORD.getIdname(), func); + } + return valueMap; + } + + @Override + public AuthType getAuthTypeImpl() { + return authTypeImpl; + } +} diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordMatchType.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordMatchType.java new file mode 100644 index 00000000000..2e3eec2c1d2 --- /dev/null +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordMatchType.java @@ -0,0 +1,131 @@ +package io.mosip.authentication.common.service.impl.match; + +import static io.mosip.authentication.core.spi.indauth.match.MatchType.setOf; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.BiFunction; +import java.util.function.Function; + +import io.mosip.authentication.core.indauth.dto.AuthRequestDTO; +import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO; +import io.mosip.authentication.core.indauth.dto.KycAuthRequestDTO; +import io.mosip.authentication.core.indauth.dto.RequestDTO; +import io.mosip.authentication.core.spi.indauth.match.IdMapping; +import io.mosip.authentication.core.spi.indauth.match.MatchType; +import io.mosip.authentication.core.spi.indauth.match.MatchingStrategy; +import io.mosip.authentication.core.spi.indauth.match.MatchingStrategyType; + +public enum PasswordMatchType implements MatchType { + + /** Primary password Match Type. */ + PASSWORD(IdaIdMapping.PASSWORD, Category.PASSWORD, setOf(PasswordMatchingStrategy.EXACT), authReq -> { + KycAuthRequestDTO kycAuthRequestDTO = (KycAuthRequestDTO)authReq; + return (Objects.nonNull(kycAuthRequestDTO.getRequest()) && + Objects.nonNull(kycAuthRequestDTO.getRequest().getPassword()))? kycAuthRequestDTO.getRequest().getPassword() : ""; + }); + + /** The allowed matching strategy. */ + private Set allowedMatchingStrategy; + + /** The request info function. */ + private Function> requestInfoFunction; + + /** The id mapping. */ + private IdMapping idMapping; + + private Category category; + + /** + * Instantiates a new demo match type. + * + * @param idMapping the id mapping + * @param allowedMatchingStrategy the allowed matching strategy + * @param requestInfoFunction the request info function + * @param langType the lang type + * @param usedBit the used bit + * @param matchedBit the matched bit + */ + private PasswordMatchType(IdMapping idMapping, Category category, Set allowedMatchingStrategy, + Function requestInfoFunction) { + this.idMapping = idMapping; + this.category = category; + this.requestInfoFunction = (AuthRequestDTO authReq) -> { + Map map = new HashMap<>(); + map.put(idMapping.getIdname(), requestInfoFunction.apply(authReq)); + return map; + }; + this.allowedMatchingStrategy = Collections.unmodifiableSet(allowedMatchingStrategy); + } + + /** + * Gets the allowed matching strategy. + * + * @param matchStrategyType the match strategy type + * @return the allowed matching strategy + */ + public Optional getAllowedMatchingStrategy(MatchingStrategyType matchStrategyType) { + return allowedMatchingStrategy.stream().filter(ms -> ms.getType().equals(matchStrategyType)).findAny(); + } + + /** + * Gets the entity info. + * + * @return the entity info + */ + public BiFunction, Map, Map> getEntityInfoMapper() { + return (entity, props) -> entity; + } + + /* + * (non-Javadoc) + * + * @see io.mosip.authentication.service.impl.indauth.service.demo.MatchType# + * getIdMapping() + */ + public IdMapping getIdMapping() { + return idMapping; + } + + /* + * (non-Javadoc) + * + * @see io.mosip.authentication.service.impl.indauth.service.demo.MatchType# + * getIdentityInfoFunction() + */ + @Override + public Function>> getIdentityInfoFunction() { + return id -> Collections.emptyMap(); + } + + /* + * (non-Javadoc) + * + * @see io.mosip.authentication.core.spi.indauth.match.MatchType#getCategory() + */ + @Override + public Category getCategory() { + return category; + } + + @Override + public Function> getReqestInfoFunction() { + return requestInfoFunction; + } + + @Override + public boolean hasIdEntityInfo() { + return true; + } + + @Override + public boolean hasRequestEntityInfo() { + return false; + } + +} diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordMatchingStrategy.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordMatchingStrategy.java new file mode 100644 index 00000000000..723a95279c9 --- /dev/null +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/match/PasswordMatchingStrategy.java @@ -0,0 +1,85 @@ +package io.mosip.authentication.common.service.impl.match; + +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.SEMI_COLON; + +import java.util.Map; + +import io.mosip.authentication.core.constant.IdAuthCommonConstants; +import io.mosip.authentication.core.constant.IdAuthenticationErrorConstants; +import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; +import io.mosip.authentication.core.logger.IdaLogger; +import io.mosip.authentication.core.spi.indauth.match.ComparePasswordFunction; +import io.mosip.authentication.core.spi.indauth.match.MatchFunction; +import io.mosip.authentication.core.spi.indauth.match.MatchingStrategy; +import io.mosip.authentication.core.spi.indauth.match.MatchingStrategyType; +import io.mosip.authentication.core.util.DemoMatcherUtil; +import io.mosip.kernel.core.logger.spi.Logger; + +public enum PasswordMatchingStrategy implements MatchingStrategy { + + EXACT(MatchingStrategyType.EXACT, (Object reqInfo, Object entityInfo, Map props) -> { + if (reqInfo instanceof Map && entityInfo instanceof Map) { + Object object = props.get(IdaIdMapping.PASSWORD.getIdname()); + if (object instanceof ComparePasswordFunction) { + ComparePasswordFunction func = (ComparePasswordFunction) object; + Map entityInfoMap = (Map) entityInfo; + Map reqInfoMap = (Map) reqInfo; + String[] hashSaltValue = entityInfoMap.get("password").split(SEMI_COLON); + String passwordHashedValue = hashSaltValue[0]; + String salt = hashSaltValue[1]; + String reqInfoValue = reqInfoMap.get(IdaIdMapping.PASSWORD.getIdname()); + boolean matched = func.matchPasswordFunction(reqInfoValue, passwordHashedValue, salt); + return !matched ? 0 : 100; + } else { + logError(); + throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.PASSWORD_MISMATCH.getErrorCode(), + IdAuthenticationErrorConstants.PASSWORD_MISMATCH.getErrorMessage()); + } + } + return 0; + }); + + private final MatchFunction matchFunction; + + /** The match strategy type. */ + private final MatchingStrategyType matchStrategyType; + + private static Logger mosipLogger = IdaLogger.getLogger(PasswordMatchingStrategy.class); + + /** + * Instantiates a new Token matching strategy. + * + * @param matchStrategyType the match strategy type + * @param matchFunction the match function + */ + private PasswordMatchingStrategy(MatchingStrategyType matchStrategyType, MatchFunction matchFunction) { + this.matchFunction = matchFunction; + this.matchStrategyType = matchStrategyType; + } + + /* (non-Javadoc) + * @see io.mosip.authentication.core.spi.indauth.match.MatchingStrategy#getType() + */ + @Override + public MatchingStrategyType getType() { + return matchStrategyType; + } + + /* (non-Javadoc) + * @see io.mosip.authentication.core.spi.indauth.match.MatchingStrategy#getMatchFunction() + */ + @Override + public MatchFunction getMatchFunction() { + return matchFunction; + } + + private static void logError() { + mosipLogger.error(IdAuthCommonConstants.SESSION_ID, IdAuthCommonConstants.PASSWORD_BASED_AUTH, + "Error in Passward Matching Strategy"); + } + + public static DemoMatcherUtil getDemoMatcherUtilObject(Map props) { + return (DemoMatcherUtil)props.get("demoMatcherUtil"); + } + +} diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/PasswordComparator.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/PasswordComparator.java new file mode 100644 index 00000000000..cafaa686935 --- /dev/null +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/integration/PasswordComparator.java @@ -0,0 +1,39 @@ + package io.mosip.authentication.common.service.integration; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import io.mosip.authentication.common.service.transaction.manager.IdAuthSecurityManager; +import io.mosip.authentication.core.constant.IdAuthCommonConstants; +import io.mosip.authentication.core.constant.IdAuthenticationErrorConstants; +import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; +import io.mosip.authentication.core.logger.IdaLogger; +import io.mosip.kernel.core.logger.spi.Logger; + + +/** + * This Class will compare the input password value with the stored Hash value & salt + * + */ +@Component +public class PasswordComparator { + + @Autowired(required = false) + private IdAuthSecurityManager securityManager; + + /** + * Logger + */ + private static Logger logger = IdaLogger.getLogger(PasswordComparator.class); + + public boolean matchPasswordFunction(String passwordValue, String passwordHashValue, String salt) throws IdAuthenticationBusinessException { + + try { + String inputPasswordHash = securityManager.generateArgon2Hash(passwordValue, salt); + return inputPasswordHash.equals(passwordHashValue); + } catch (Exception e) { + logger.error(IdAuthCommonConstants.SESSION_ID, this.getClass().getName(), e.getLocalizedMessage(),e.getMessage()); + throw new IdAuthenticationBusinessException(IdAuthenticationErrorConstants.SERVER_ERROR, e); + } + } +} diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/transaction/manager/IdAuthSecurityManager.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/transaction/manager/IdAuthSecurityManager.java index 6115f62ef9c..412ec9aefe0 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/transaction/manager/IdAuthSecurityManager.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/transaction/manager/IdAuthSecurityManager.java @@ -49,6 +49,8 @@ import io.mosip.kernel.core.util.DateUtils; import io.mosip.kernel.core.util.HMACUtils2; import io.mosip.kernel.crypto.jce.core.CryptoCore; +import io.mosip.kernel.cryptomanager.dto.Argon2GenerateHashRequestDto; +import io.mosip.kernel.cryptomanager.dto.Argon2GenerateHashResponseDto; import io.mosip.kernel.cryptomanager.dto.CryptomanagerRequestDto; import io.mosip.kernel.cryptomanager.dto.JWTCipherResponseDto; import io.mosip.kernel.cryptomanager.service.CryptomanagerService; @@ -705,4 +707,12 @@ public String jwtEncrypt(String dataToEncrypt, String certificateData) { JWTCipherResponseDto cipherResponseDto = cryptomanagerService.jwtEncrypt(encryptRequestDto); return cipherResponseDto.getData(); } + + public String generateArgon2Hash(String anyString, String salt) { + Argon2GenerateHashRequestDto hashRequestDto = new Argon2GenerateHashRequestDto(); + hashRequestDto.setInputData(anyString); + hashRequestDto.setSalt(salt); + Argon2GenerateHashResponseDto hashResponseDto = cryptomanagerService.generateArgon2Hash(hashRequestDto); + return hashResponseDto.getHashValue(); + } } diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/util/AuthTypeUtil.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/util/AuthTypeUtil.java index 4847e1e3d05..5c6ea119e84 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/util/AuthTypeUtil.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/util/AuthTypeUtil.java @@ -9,6 +9,7 @@ import io.mosip.authentication.common.service.impl.match.DemoAuthType; import io.mosip.authentication.common.service.impl.match.PinAuthType; import io.mosip.authentication.common.service.impl.match.KeyBindedTokenAuthType; +import io.mosip.authentication.common.service.impl.match.PasswordAuthType; import io.mosip.authentication.core.constant.RequestType; import io.mosip.authentication.core.indauth.dto.AuthRequestDTO; import io.mosip.authentication.core.indauth.dto.EkycAuthRequestDTO; @@ -38,6 +39,10 @@ public static boolean isKeyBindedToken(AuthRequestDTO authReqDto) { return isAuthTypeInfoAvailable(authReqDto, new AuthType[] {KeyBindedTokenAuthType.KEYBINDEDTOKEN}); } + public static boolean isPassword(AuthRequestDTO authReqDto) { + return isAuthTypeInfoAvailable(authReqDto, new AuthType[] {PasswordAuthType.PASSWORD}); + } + private static boolean isAuthTypeInfoAvailable(AuthRequestDTO authReqDto, AuthType[] values) { return Stream.of(values).anyMatch(authType -> authType.isAuthTypeInfoAvailable(authReqDto)); } @@ -67,6 +72,10 @@ public static List findAutRequestTypes(AuthRequestDTO authRequestDT if(authRequestDTO instanceof EkycAuthRequestDTO) { requestTypes.add(RequestType.EKYC_AUTH_REQUEST); } + + if (AuthTypeUtil.isPassword(authRequestDTO)) { + requestTypes.add(RequestType.PASSWORD_AUTH); + } return requestTypes; } diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditEvents.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditEvents.java index f46389d51a8..566996881ca 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditEvents.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditEvents.java @@ -49,6 +49,8 @@ public enum AuditEvents { VCI_EXCHANGE_REQUEST_RESPONSE("IDA_017", "System", "Vci Exchange Request"), + PASSWORD_BASED_AUTH_REQUEST("IDA_018", "System", "Password Based Auth Request"), + /** Static_Pin_Storage_Request_Response. */ STATIC_PIN_STORAGE_REQUEST_RESPONSE("IDA-EVT-OLD-006","BUSINESS", ""),//not applicable for release v1 diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditModules.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditModules.java index f6419cbd278..0069e5c6867 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditModules.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/AuditModules.java @@ -23,6 +23,8 @@ public enum AuditModules { FACE_AUTH("IDA-FAA", "Face Authentication Request", "Face Authenticator"), TOKEN_AUTH("IDA-TOA","Token Authentication requested", "Token Authenticator"), + + PASSWORD_AUTH("IDA-PSD","Password Authentication requested", "Password Authenticator"), /** The e KY C AUTH. */ EKYC_AUTH("IDA-EKA", "E-KYC Authentication Request", "eKYC Authenticator"), diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java index 3ef269091ac..04f3fc39f0c 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java @@ -445,6 +445,12 @@ public final class IdAuthCommonConstants { public static final String VC_CREDENTIAL_DEF = "credentialsDefinition"; + public static final String PASSWORD_BASED_AUTH = "PasswordBasedAuth"; + + public static final String PASSWORD = "password"; + + public static final String SEMI_COLON = ";"; + private IdAuthCommonConstants() { } } diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthenticationErrorConstants.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthenticationErrorConstants.java index 4614fc484e3..2dc9646cd6c 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthenticationErrorConstants.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthenticationErrorConstants.java @@ -213,9 +213,12 @@ public enum IdAuthenticationErrorConstants { CREATE_VCI_PUBLIC_KEY_OBJECT_ERROR("IDA-VCI-002", "Error creating Public Key object."), KEY_ALREADY_MAPPED_ERROR("IDA-VCI-003", "Error Key already mapped to different id/vid."), VCI_NOT_SUPPORTED_ERROR("IDA-VCI-004", "Error VCI not supported."), - LDP_VC_GENERATION_FAILED("IDA-VCI-005", "Ldp VC generation Failed."); + LDP_VC_GENERATION_FAILED("IDA-VCI-005", "Ldp VC generation Failed."), + + PASSWORD_MISMATCH("IDA-PSD-001", "Password value did not match", "Please re-enter your password"), + PASSWORD_MISSING("IDA-PSD-002", "For the input VID/UIN - No Password found in DB.", + "Please use UIN/VID with Password Auth."); - private final String errorCode; private final String errorMessage; private String actionMessage; diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/RequestType.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/RequestType.java index 88733da11a2..870913f7ef8 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/RequestType.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/RequestType.java @@ -21,7 +21,8 @@ public enum RequestType { IDENTITY_KEY_BINDING("IDENTITY-KEY-BINDING","Identity Key Binding Request"), TOKEN_REQUEST("TOKEN-REQUEST", "Token Request"), TOKEN_AUTH("TOKEN-AUTH","Token based Authentication"), - VCI_EXCHANGE_REQUEST("VCI-EXCHANGE-REQUEST","VCI Exchange Request"); + VCI_EXCHANGE_REQUEST("VCI-EXCHANGE-REQUEST","VCI Exchange Request"), + PASSWORD_AUTH("PASSWORD-AUTH","Password Auth"); String type; String message; diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/indauth/dto/KycRequestDTO.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/indauth/dto/KycRequestDTO.java index 90c9587478f..02fda3481ad 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/indauth/dto/KycRequestDTO.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/indauth/dto/KycRequestDTO.java @@ -10,4 +10,6 @@ public class KycRequestDTO extends RequestDTO { /** H/W or S/W token */ private List keyBindedTokens; + + private String password; } diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/ComparePasswordFunction.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/ComparePasswordFunction.java new file mode 100644 index 00000000000..41464cc05bb --- /dev/null +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/ComparePasswordFunction.java @@ -0,0 +1,22 @@ +package io.mosip.authentication.core.spi.indauth.match; + +import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; + +/** + * To match Password against Stored Hashed Password and Salt + + */ +public interface ComparePasswordFunction { + + /** + * To Match Password. + * + * @param passwordValue the password value + * @param passwordHashValue the stored password hash value + * @param salt the stored salt value + * @return true, if successful + * @throws IdAuthenticationBusinessException the id authentication business exception + */ + public boolean matchPasswordFunction(String passwordValue, String passwordHashValue, String salt) throws IdAuthenticationBusinessException; + +} diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/IdInfoFetcher.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/IdInfoFetcher.java index 92c1585159b..2d168eeb52e 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/IdInfoFetcher.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/IdInfoFetcher.java @@ -1,241 +1,258 @@ -package io.mosip.authentication.core.spi.indauth.match; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.springframework.core.env.Environment; - -import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; -import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO; -import io.mosip.authentication.core.indauth.dto.RequestDTO; -import io.mosip.authentication.core.spi.bioauth.CbeffDocType; -import io.mosip.authentication.core.util.DemoMatcherUtil; -import io.mosip.authentication.core.util.DemoNormalizer; - -/** - * The IdInfoFetcher interface that provides the helper methods invoked by the - * classes involved in ID Info matching. - * - * @author Loganathan.Sekar - * @author Nagarjuna - */ -public interface IdInfoFetcher { - - /** - * Gets the template default language codes - * @return - */ - public List getTemplatesDefaultLanguageCodes(); - - /** - * Gets the system supported languages. - * Combination of Mandatory and optional languages. - * @return - */ - public List getSystemSupportedLanguageCodes(); - - /** - * To check language type. - * - * @param languageForMatchType the language for match type - * @param languageFromReq the language from req - * @return true, if successful - */ - public boolean checkLanguageType(String languageForMatchType, String languageFromReq); - - /** - * Get language name for Match Properties based on language code. - * - * @param languageCode language code - * @return language name - */ - public Optional getLanguageName(String languageCode); - - /** - * Gets the identity info for the MatchType from the IdentityDTO. - * - * @param matchType the match type - * @param idName - * @param identity the identity - * @param language the language - * @return the identity info - */ - public Map getIdentityRequestInfo(MatchType matchType, String idName, RequestDTO identity, String language); - - /** - * Gets the identity info. - * - * @param matchType the match type - * @param idName the id name - * @param identity the identity - * @return the identity info - */ - public Map> getIdentityInfo(MatchType matchType, String idName, RequestDTO identity); - - /** - * Gets the identity info for the MatchType from the IdentityDTO. - * - * @param matchType the match type - * @param idName - * @param identity the identity - * @param language the language - * @return the identity info - */ - public Map getIdentityRequestInfo(MatchType matchType, RequestDTO identity, String language); - - /** - * Get the Validate Otp function. - * - * @return the ValidateOtpFunction - */ - public ValidateOtpFunction getValidateOTPFunction(); - - /** - * To fetch cbeff values. - * - * @param idEntity the id entity - * @param cbeffDocTypes the cbeff doc types - * @param matchType the match type - * @return the cbeff values - * @throws IdAuthenticationBusinessException the id authentication business exception - */ - public Map>> getCbeffValues(Map> idEntity, - CbeffDocType[] cbeffDocTypes, MatchType matchType) throws IdAuthenticationBusinessException; - - /** - * To get EnvPropertyResolver. - * - * @return the environment - */ - public Environment getEnvironment(); - - /** - * Title info fetcher from Master data manager. - * - * @return the title fetcher - */ - public MasterDataFetcher getTitleFetcher(); - - /** - * Gets the matching threshold. - * - * @param key the key - * @return the matching threshold - */ - public Optional getMatchingThreshold(String key); - - - /** - * Gets the demo normalizer object to normalise the - * corresponding(address/name) used for demographic authentication - * . - * - * @return the demo normalizer - */ - public DemoNormalizer getDemoNormalizer(); - - /** - * Gets the user preferred language attribute - * @return - */ - public List getUserPreferredLanguages(Map> idInfo); - - - /** - * Gets the match function. - * - * @param authType the auth type - * @return the match function - */ - public TriFunctionWithBusinessException, Map, Map, Double> getMatchFunction(AuthType authType); - - - /** - * Gets the type for id name. - * - * @param idName the id name - * @param idMappings the id mappings - * @return the type for id name - */ - public Optional getTypeForIdName(String idName, IdMapping[] idMappings); - - /** - * Gets the mapping config. - * - * @return the mapping config - */ - public MappingConfig getMappingConfig(); - - /** - * - * @return - */ - public DemoMatcherUtil getDemoMatcherUtil(); - - - /** - * Gets the available dynamic attributes names. - * - * @param request the request - * @return the available dynamic attributes names - */ - Set getAvailableDynamicAttributesNames(RequestDTO request); - - /** - * Fetch data from Identity info value based on Identity response. - * - * @param idResponseDTO the id response DTO - * @return the id info - * @throws IdAuthenticationBusinessException the id authentication business exception - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static Map> getIdInfo(Map idResponseDTO) { - return idResponseDTO.entrySet().stream().flatMap(entry -> { - if (entry.getValue() instanceof Map) { - return ((Map) entry.getValue()).entrySet().stream(); - } else { - return Stream.of(entry); - } - }).collect(Collectors.toMap(t -> t.getKey(), entry -> { - Object val = entry.getValue(); - if (val instanceof List) { - List arrayList = (List) val; - if (!arrayList.isEmpty()) { - Object object = arrayList.get(0); - if (object instanceof Map) { - return arrayList.stream().filter(elem -> elem instanceof Map) - .map(elem -> (Map) elem).map(map1 -> { - String value = String.valueOf(map1.get("value")); - IdentityInfoDTO idInfo = new IdentityInfoDTO(); - if (map1.containsKey("language")) { - idInfo.setLanguage(String.valueOf(map1.get("language"))); - } - idInfo.setValue(value); - return idInfo; - }).collect(Collectors.toList()); - - } else if (object instanceof String) { - return arrayList.stream().map(string -> { - String value = (String) string; - IdentityInfoDTO idInfo = new IdentityInfoDTO(); - idInfo.setValue(value); - return idInfo; - }).collect(Collectors.toList()); - } - } - } else if (val instanceof Boolean || val instanceof String || val instanceof Long || val instanceof Integer - || val instanceof Double || val instanceof Float) { - IdentityInfoDTO idInfo = new IdentityInfoDTO(); - idInfo.setValue(String.valueOf(val)); - return Stream.of(idInfo).collect(Collectors.toList()); - } - return Collections.emptyList(); - })); - } -} +package io.mosip.authentication.core.spi.indauth.match; + +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.PASSWORD; +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.SEMI_COLON; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.springframework.core.env.Environment; + +import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; +import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO; +import io.mosip.authentication.core.indauth.dto.RequestDTO; +import io.mosip.authentication.core.spi.bioauth.CbeffDocType; +import io.mosip.authentication.core.util.DemoMatcherUtil; +import io.mosip.authentication.core.util.DemoNormalizer; + +/** + * The IdInfoFetcher interface that provides the helper methods invoked by the + * classes involved in ID Info matching. + * + * @author Loganathan.Sekar + * @author Nagarjuna + */ +public interface IdInfoFetcher { + + /** + * Gets the template default language codes + * @return + */ + public List getTemplatesDefaultLanguageCodes(); + + /** + * Gets the system supported languages. + * Combination of Mandatory and optional languages. + * @return + */ + public List getSystemSupportedLanguageCodes(); + + /** + * To check language type. + * + * @param languageForMatchType the language for match type + * @param languageFromReq the language from req + * @return true, if successful + */ + public boolean checkLanguageType(String languageForMatchType, String languageFromReq); + + /** + * Get language name for Match Properties based on language code. + * + * @param languageCode language code + * @return language name + */ + public Optional getLanguageName(String languageCode); + + /** + * Gets the identity info for the MatchType from the IdentityDTO. + * + * @param matchType the match type + * @param idName + * @param identity the identity + * @param language the language + * @return the identity info + */ + public Map getIdentityRequestInfo(MatchType matchType, String idName, RequestDTO identity, String language); + + /** + * Gets the identity info. + * + * @param matchType the match type + * @param idName the id name + * @param identity the identity + * @return the identity info + */ + public Map> getIdentityInfo(MatchType matchType, String idName, RequestDTO identity); + + /** + * Gets the identity info for the MatchType from the IdentityDTO. + * + * @param matchType the match type + * @param idName + * @param identity the identity + * @param language the language + * @return the identity info + */ + public Map getIdentityRequestInfo(MatchType matchType, RequestDTO identity, String language); + + /** + * Get the Validate Otp function. + * + * @return the ValidateOtpFunction + */ + public ValidateOtpFunction getValidateOTPFunction(); + + /** + * To fetch cbeff values. + * + * @param idEntity the id entity + * @param cbeffDocTypes the cbeff doc types + * @param matchType the match type + * @return the cbeff values + * @throws IdAuthenticationBusinessException the id authentication business exception + */ + public Map>> getCbeffValues(Map> idEntity, + CbeffDocType[] cbeffDocTypes, MatchType matchType) throws IdAuthenticationBusinessException; + + /** + * To get EnvPropertyResolver. + * + * @return the environment + */ + public Environment getEnvironment(); + + /** + * Title info fetcher from Master data manager. + * + * @return the title fetcher + */ + public MasterDataFetcher getTitleFetcher(); + + /** + * Gets the matching threshold. + * + * @param key the key + * @return the matching threshold + */ + public Optional getMatchingThreshold(String key); + + + /** + * Gets the demo normalizer object to normalise the + * corresponding(address/name) used for demographic authentication + * . + * + * @return the demo normalizer + */ + public DemoNormalizer getDemoNormalizer(); + + /** + * Gets the user preferred language attribute + * @return + */ + public List getUserPreferredLanguages(Map> idInfo); + + + /** + * Gets the match function. + * + * @param authType the auth type + * @return the match function + */ + public TriFunctionWithBusinessException, Map, Map, Double> getMatchFunction(AuthType authType); + + + /** + * Gets the type for id name. + * + * @param idName the id name + * @param idMappings the id mappings + * @return the type for id name + */ + public Optional getTypeForIdName(String idName, IdMapping[] idMappings); + + /** + * Gets the mapping config. + * + * @return the mapping config + */ + public MappingConfig getMappingConfig(); + + /** + * + * @return + */ + public DemoMatcherUtil getDemoMatcherUtil(); + + + /** + * Gets the available dynamic attributes names. + * + * @param request the request + * @return the available dynamic attributes names + */ + Set getAvailableDynamicAttributesNames(RequestDTO request); + + /** + * Fetch data from Identity info value based on Identity response. + * + * @param idResponseDTO the id response DTO + * @return the id info + * @throws IdAuthenticationBusinessException the id authentication business exception + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static Map> getIdInfo(Map idResponseDTO) { + return idResponseDTO.entrySet().stream().flatMap(entry -> { + if (entry.getValue() instanceof Map) { + return ((Map) entry.getValue()).entrySet().stream(); + } else { + return Stream.of(entry); + } + }).collect(Collectors.toMap(t -> t.getKey(), entry -> { + Object val = entry.getValue(); + if (val instanceof List) { + List arrayList = (List) val; + if (!arrayList.isEmpty()) { + Object object = arrayList.get(0); + if (object instanceof Map) { + return arrayList.stream().filter(elem -> elem instanceof Map) + .map(elem -> (Map) elem).map(map1 -> { + String value = String.valueOf(map1.get("value")); + IdentityInfoDTO idInfo = new IdentityInfoDTO(); + if (map1.containsKey("language")) { + idInfo.setLanguage(String.valueOf(map1.get("language"))); + } + idInfo.setValue(value); + return idInfo; + }).collect(Collectors.toList()); + + } else if (object instanceof String) { + return arrayList.stream().map(string -> { + String value = (String) string; + IdentityInfoDTO idInfo = new IdentityInfoDTO(); + idInfo.setValue(value); + return idInfo; + }).collect(Collectors.toList()); + } + } + } else if (val instanceof Boolean || val instanceof String || val instanceof Long || val instanceof Integer + || val instanceof Double || val instanceof Float) { + IdentityInfoDTO idInfo = new IdentityInfoDTO(); + idInfo.setValue(String.valueOf(val)); + return Stream.of(idInfo).collect(Collectors.toList()); + } else if (entry.getKey().equals(PASSWORD) && val instanceof Map) { + Map map = (Map) val; + String passwordData = map.entrySet().stream().map(mapEntry -> mapEntry.getValue() ).collect(Collectors.joining(SEMI_COLON)); + IdentityInfoDTO idInfo = new IdentityInfoDTO(); + idInfo.setValue(String.valueOf(passwordData)); + return Stream.of(idInfo).collect(Collectors.toList()); + } + + return Collections.emptyList(); + })); + } + + /** + * To Get match Password function. + * + * @return the ComparePasswordFunction + */ + public ComparePasswordFunction getMatchPasswordFunction(); +} diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MappingConfig.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MappingConfig.java index 4f8e57e2fef..b7281c5acb8 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MappingConfig.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MappingConfig.java @@ -1,245 +1,252 @@ -package io.mosip.authentication.core.spi.indauth.match; - -import java.util.List; -import java.util.Map; - -/** - * The Interface MappingConfig. - * - * @author Dinesh Karuppiah.T - */ - -public interface MappingConfig { - - /** - * List of value to hold Full Name. - * - * @return the name - */ - public List getName(); - - /** - * List of value to hold DOB. - * - * @return the dob - */ - public List getDob(); - - /** - * List of value to hold DOBtype. - * - * @return the dob type - */ - public List getDobType(); - - /** - * List of value to hold Age. - * - * @return the age - */ - public List getAge(); - - /** - * List of value to hold Gender. - * - * @return the gender - */ - public List getGender(); - - /** - * List of value to hold Phone Number. - * - * @return the phone number - */ - public List getPhoneNumber(); - - /** - * List of value to hold Email ID. - * - * @return the email id - */ - public List getEmailId(); - - /** - * List of value to hold Address Line 1. - * - * @return the address line 1 - */ - public List getAddressLine1(); - - /** - * List of value to hold Address Line 2. - * - * @return the address line 2 - */ - public List getAddressLine2(); - - /** - * List of value to hold Address Line 3. - * - * @return the address line 3 - */ - public List getAddressLine3(); - - /** - * List of value to hold Location 1. - * - * @return the location 1 - */ - public List getLocation1(); - - /** - * List of value to hold Location 2. - * - * @return the location 2 - */ - public List getLocation2(); - - /** - * List of value to hold Location 3. - * - * @return the location 3 - */ - public List getLocation3(); - - /** - * List of value to hold Postalcode. - * - * @return the pin code - */ - public List getPostalCode(); - - /** - * List of value to hold Full Address. - * - * @return the full address - */ - public List getFullAddress(); - - /** - * List of value to hold Otp. - * - * @return the otp - */ - public List getOtp(); - - /** - * List of value to hold Pin. - * - * @return the pin - */ - public List getPin(); - - /** - * List of value to hold IRIS. - * - * @return the iris - */ - public List getIris(); - - /** - * List of value to hold Left Index. - * - * @return the left index - */ - - public List getLeftIndex(); - - /** - * List of value to hold Left Little. - * - * @return the left little - */ - public List getLeftLittle(); - - /** - * List of value to hold Left Middle. - * - * @return the left middle - */ - public List getLeftMiddle(); - - /** - * List of value to hold Left Ring. - * - * @return the left ring - */ - public List getLeftRing(); - - /** - * List of value to hold Left Thumb. - * - * @return the left thumb - */ - public List getLeftThumb(); - - /** - * List of value to hold Right Index. - * - * @return the right index - */ - public List getRightIndex(); - - /** - * List of value to hold Right Little. - * - * @return the right little - */ - public List getRightLittle(); - - /** - * List of value to hold Right Middle. - * - * @return the right middle - */ - public List getRightMiddle(); - - /** - * List of value to hold Right Ring. - * - * @return the right ring - */ - public List getRightRing(); - - /** - * List of value to hold Right Thumb. - * - * @return the right thumb - */ - public List getRightThumb(); - - /** - * List of value to hold Finger print. - * - * @return the fingerprint - */ - public List getFingerprint(); - - /** - * List of value to hold Face. - * - * @return the face - */ - public List getFace(); - - /** - * Gets the left eye. - * - * @return the left eye - */ - public List getLeftEye(); - - /** - * Gets the right eye. - * - * @return the right eye - */ - public List getRightEye(); - - /** - * Gets the dynamic attributes. - * - * @return the dynamic attributes - */ - public Map> getDynamicAttributes(); -} +package io.mosip.authentication.core.spi.indauth.match; + +import java.util.List; +import java.util.Map; + +/** + * The Interface MappingConfig. + * + * @author Dinesh Karuppiah.T + */ + +public interface MappingConfig { + + /** + * List of value to hold Full Name. + * + * @return the name + */ + public List getName(); + + /** + * List of value to hold DOB. + * + * @return the dob + */ + public List getDob(); + + /** + * List of value to hold DOBtype. + * + * @return the dob type + */ + public List getDobType(); + + /** + * List of value to hold Age. + * + * @return the age + */ + public List getAge(); + + /** + * List of value to hold Gender. + * + * @return the gender + */ + public List getGender(); + + /** + * List of value to hold Phone Number. + * + * @return the phone number + */ + public List getPhoneNumber(); + + /** + * List of value to hold Email ID. + * + * @return the email id + */ + public List getEmailId(); + + /** + * List of value to hold Address Line 1. + * + * @return the address line 1 + */ + public List getAddressLine1(); + + /** + * List of value to hold Address Line 2. + * + * @return the address line 2 + */ + public List getAddressLine2(); + + /** + * List of value to hold Address Line 3. + * + * @return the address line 3 + */ + public List getAddressLine3(); + + /** + * List of value to hold Location 1. + * + * @return the location 1 + */ + public List getLocation1(); + + /** + * List of value to hold Location 2. + * + * @return the location 2 + */ + public List getLocation2(); + + /** + * List of value to hold Location 3. + * + * @return the location 3 + */ + public List getLocation3(); + + /** + * List of value to hold Postalcode. + * + * @return the pin code + */ + public List getPostalCode(); + + /** + * List of value to hold Full Address. + * + * @return the full address + */ + public List getFullAddress(); + + /** + * List of value to hold Otp. + * + * @return the otp + */ + public List getOtp(); + + /** + * List of value to hold Pin. + * + * @return the pin + */ + public List getPin(); + + /** + * List of value to hold IRIS. + * + * @return the iris + */ + public List getIris(); + + /** + * List of value to hold Left Index. + * + * @return the left index + */ + + public List getLeftIndex(); + + /** + * List of value to hold Left Little. + * + * @return the left little + */ + public List getLeftLittle(); + + /** + * List of value to hold Left Middle. + * + * @return the left middle + */ + public List getLeftMiddle(); + + /** + * List of value to hold Left Ring. + * + * @return the left ring + */ + public List getLeftRing(); + + /** + * List of value to hold Left Thumb. + * + * @return the left thumb + */ + public List getLeftThumb(); + + /** + * List of value to hold Right Index. + * + * @return the right index + */ + public List getRightIndex(); + + /** + * List of value to hold Right Little. + * + * @return the right little + */ + public List getRightLittle(); + + /** + * List of value to hold Right Middle. + * + * @return the right middle + */ + public List getRightMiddle(); + + /** + * List of value to hold Right Ring. + * + * @return the right ring + */ + public List getRightRing(); + + /** + * List of value to hold Right Thumb. + * + * @return the right thumb + */ + public List getRightThumb(); + + /** + * List of value to hold Finger print. + * + * @return the fingerprint + */ + public List getFingerprint(); + + /** + * List of value to hold Face. + * + * @return the face + */ + public List getFace(); + + /** + * Gets the left eye. + * + * @return the left eye + */ + public List getLeftEye(); + + /** + * Gets the right eye. + * + * @return the right eye + */ + public List getRightEye(); + + /** + * Gets the dynamic attributes. + * + * @return the dynamic attributes + */ + public Map> getDynamicAttributes(); + + /** + * List of value to hold password. + * + * @return the password + */ + public List getPassword(); +} diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MatchType.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MatchType.java index cc4d4343e12..6feaccc5d3c 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MatchType.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/match/MatchType.java @@ -17,6 +17,7 @@ import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; import io.mosip.authentication.core.indauth.dto.AuthRequestDTO; import io.mosip.authentication.core.indauth.dto.IdentityInfoDTO; +import io.mosip.authentication.core.indauth.dto.KycAuthRequestDTO; import io.mosip.authentication.core.indauth.dto.RequestDTO; /** @@ -41,7 +42,9 @@ public enum Category { /** s-pin category. */ SPIN("pin"), /** Token category */ - KBT("kbt"); + KBT("kbt"), + /** Password category */ + PASSWORD("password"); /** The type. */ String type; diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/service/PasswordAuthService.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/service/PasswordAuthService.java new file mode 100644 index 00000000000..7b22ba59bf6 --- /dev/null +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/spi/indauth/service/PasswordAuthService.java @@ -0,0 +1,4 @@ +package io.mosip.authentication.core.spi.indauth.service; + +public interface PasswordAuthService extends AuthService { +} diff --git a/authentication/authentication-internal-service/Dockerfile b/authentication/authentication-internal-service/Dockerfile index 7e27c6b8402..b5239d29a7a 100644 --- a/authentication/authentication-internal-service/Dockerfile +++ b/authentication/authentication-internal-service/Dockerfile @@ -108,6 +108,8 @@ ENV current_module_env=authentication-internal-service ADD configure_start.sh configure_start.sh +ADD ./lib/* "${loader_path_env}"/ + RUN chmod +x configure_start.sh ADD target/${current_module_env}-*.jar ${current_module_env}.jar diff --git a/authentication/authentication-internal-service/lib/libargon2.so b/authentication/authentication-internal-service/lib/libargon2.so new file mode 100755 index 00000000000..bf8cad86215 Binary files /dev/null and b/authentication/authentication-internal-service/lib/libargon2.so differ diff --git a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/InternalAuthenticationApplication.java b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/InternalAuthenticationApplication.java index 169c4a4feb6..808ad5a3ffd 100644 --- a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/InternalAuthenticationApplication.java +++ b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/InternalAuthenticationApplication.java @@ -31,6 +31,7 @@ import io.mosip.authentication.common.service.impl.KeyBindedTokenAuthServiceImpl; import io.mosip.authentication.common.service.impl.OTPAuthServiceImpl; import io.mosip.authentication.common.service.impl.OTPServiceImpl; +import io.mosip.authentication.common.service.impl.PasswordAuthServiceImpl; import io.mosip.authentication.common.service.impl.hotlist.HotlistServiceImpl; import io.mosip.authentication.common.service.impl.idevent.CredentialStoreServiceImpl; import io.mosip.authentication.common.service.impl.idevent.IdChangeEventHandlerServiceImpl; @@ -46,6 +47,7 @@ import io.mosip.authentication.common.service.integration.NotificationManager; import io.mosip.authentication.common.service.integration.OTPManager; import io.mosip.authentication.common.service.integration.PartnerServiceManager; +import io.mosip.authentication.common.service.integration.PasswordComparator; import io.mosip.authentication.common.service.integration.TokenIdManager; import io.mosip.authentication.common.service.util.BioMatcherUtil; import io.mosip.authentication.common.service.util.EnvUtil; @@ -135,7 +137,8 @@ io.mosip.kernel.keymanagerservice.dto.AuthorizedRolesDTO.class, io.mosip.kernel.partnercertservice.dto.AuthorizedRolesDTO.class, io.mosip.kernel.signature.dto.AuthorizedRolesDTO.class, - EnvUtil.class, KeyBindedTokenMatcherUtil.class, HSMHealthCheck.class, PrivateKeyDecryptorHelper.class }) + EnvUtil.class, KeyBindedTokenMatcherUtil.class, HSMHealthCheck.class, PrivateKeyDecryptorHelper.class, + PasswordAuthServiceImpl.class, PasswordComparator.class }) @ComponentScan(basePackages = { "io.mosip.authentication.internal.service.*", "${mosip.auth.adapter.impl.basepackage}", "io.mosip.kernel.core.logger.config", "io.mosip.authentication.common.service.config" }, excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = { diff --git a/authentication/authentication-otp-service/Dockerfile b/authentication/authentication-otp-service/Dockerfile index 9228889b97c..8744dbba1b6 100644 --- a/authentication/authentication-otp-service/Dockerfile +++ b/authentication/authentication-otp-service/Dockerfile @@ -91,6 +91,8 @@ ENV current_module_env=authentication-otp-service ADD configure_start.sh configure_start.sh +ADD ./lib/* "${loader_path_env}"/ + RUN chmod +x configure_start.sh ADD target/${current_module_env}-*.jar ${current_module_env}.jar diff --git a/authentication/authentication-otp-service/lib/libargon2.so b/authentication/authentication-otp-service/lib/libargon2.so new file mode 100755 index 00000000000..bf8cad86215 Binary files /dev/null and b/authentication/authentication-otp-service/lib/libargon2.so differ diff --git a/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/OtpApplication.java b/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/OtpApplication.java index 8eada82060b..bd2ed775ec3 100644 --- a/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/OtpApplication.java +++ b/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/OtpApplication.java @@ -30,6 +30,7 @@ import io.mosip.authentication.common.service.impl.KeyBindedTokenAuthServiceImpl; import io.mosip.authentication.common.service.impl.OTPAuthServiceImpl; import io.mosip.authentication.common.service.impl.OTPServiceImpl; +import io.mosip.authentication.common.service.impl.PasswordAuthServiceImpl; import io.mosip.authentication.common.service.impl.hotlist.HotlistServiceImpl; import io.mosip.authentication.common.service.impl.masterdata.MasterDataCacheUpdateServiceImpl; import io.mosip.authentication.common.service.impl.notification.NotificationServiceImpl; @@ -41,6 +42,7 @@ import io.mosip.authentication.common.service.integration.NotificationManager; import io.mosip.authentication.common.service.integration.OTPManager; import io.mosip.authentication.common.service.integration.PartnerServiceManager; +import io.mosip.authentication.common.service.integration.PasswordComparator; import io.mosip.authentication.common.service.integration.TokenIdManager; import io.mosip.authentication.common.service.transaction.manager.IdAuthSecurityManager; import io.mosip.authentication.common.service.util.EnvUtil; @@ -108,7 +110,8 @@ LangComparatorConfig.class, OpenApiProperties.class, SessionKeyDecrytorHelper.class, ExternalRestHelperConfig.class, IdaRequestResponsConsumerUtil.class, PartnerCACertEventServiceImpl.class, PartnerCACertEventInitializer.class, IdAuthWebSubInitializer.class, AuthAnonymousEventPublisher.class, EnvUtil.class, KeyBindedTokenMatcherUtil.class, - HSMHealthCheck.class, PrivateKeyDecryptorHelper.class }) + HSMHealthCheck.class, PrivateKeyDecryptorHelper.class, + PasswordAuthServiceImpl.class, PasswordComparator.class }) @ComponentScan(basePackages = { "io.mosip.authentication.otp.service.*", "io.mosip.kernel.core.logger.config", "${mosip.auth.adapter.impl.basepackage}" }, excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = { "io.mosip.idrepository.core.config.IdRepoDataSourceConfig.*" })) diff --git a/authentication/authentication-service/Dockerfile b/authentication/authentication-service/Dockerfile index ab0a6b78234..805fd9b3a84 100644 --- a/authentication/authentication-service/Dockerfile +++ b/authentication/authentication-service/Dockerfile @@ -111,6 +111,8 @@ ENV current_module_env=authentication-service ADD configure_start.sh configure_start.sh +ADD ./lib/* "${loader_path_env}"/ + RUN chmod +x configure_start.sh ADD target/${current_module_env}-*.jar ${current_module_env}.jar diff --git a/authentication/authentication-service/lib/libargon2.so b/authentication/authentication-service/lib/libargon2.so new file mode 100755 index 00000000000..bf8cad86215 Binary files /dev/null and b/authentication/authentication-service/lib/libargon2.so differ diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/IdAuthenticationApplication.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/IdAuthenticationApplication.java index 1f54f60bdec..ff5e3055cbc 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/IdAuthenticationApplication.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/IdAuthenticationApplication.java @@ -33,6 +33,7 @@ import io.mosip.authentication.common.service.impl.IdInfoFetcherImpl; import io.mosip.authentication.common.service.impl.IdServiceImpl; import io.mosip.authentication.common.service.impl.OTPAuthServiceImpl; +import io.mosip.authentication.common.service.impl.PasswordAuthServiceImpl; import io.mosip.authentication.common.service.impl.KeyBindedTokenAuthServiceImpl; import io.mosip.authentication.common.service.impl.hotlist.HotlistServiceImpl; import io.mosip.authentication.common.service.impl.masterdata.MasterDataCacheUpdateServiceImpl; @@ -45,6 +46,7 @@ import io.mosip.authentication.common.service.integration.NotificationManager; import io.mosip.authentication.common.service.integration.OTPManager; import io.mosip.authentication.common.service.integration.PartnerServiceManager; +import io.mosip.authentication.common.service.integration.PasswordComparator; import io.mosip.authentication.common.service.integration.TokenIdManager; import io.mosip.authentication.common.service.transaction.manager.IdAuthSecurityManager; import io.mosip.authentication.common.service.util.BioMatcherUtil; @@ -102,7 +104,7 @@ */ @SpringBootApplication(exclude = { HibernateDaoConfig.class, SecurityAutoConfiguration.class }) @Import(value = { IdValidationUtil.class, IDAMappingConfig.class, KeyBindedTokenAuthServiceImpl.class, - AuthContextClazzRefProvider.class, CbeffImpl.class, + AuthContextClazzRefProvider.class, CbeffImpl.class, RestRequestFactory.class, AuditRequestFactory.class, AuditRequestFactory.class, NotificationManager.class, NotificationServiceImpl.class, IdTemplateManager.class, TemplateManagerBuilderImpl.class, IdAuthExceptionHandler.class, IdInfoFetcherImpl.class, OTPManager.class, MasterDataManager.class, IdInfoHelper.class, OTPAuthServiceImpl.class, @@ -122,7 +124,8 @@ IdAuthFraudAnalysisEventManager.class, IdAuthFraudAnalysisEventPublisher.class, AuthFiltersValidator.class, AuthAnonymousProfileServiceImpl.class, AuthAnonymousEventPublisher.class, SessionKeyDecrytorHelper.class, ExternalRestHelperConfig.class, IdaRequestResponsConsumerUtil.class, PartnerCACertEventServiceImpl.class, PartnerCACertEventInitializer.class, EnvUtil.class, KeyBindedTokenMatcherUtil.class, - HSMHealthCheck.class, TokenValidationHelper.class, VCSchemaProviderUtil.class, PrivateKeyDecryptorHelper.class }) + HSMHealthCheck.class, TokenValidationHelper.class, VCSchemaProviderUtil.class, PrivateKeyDecryptorHelper.class, + PasswordAuthServiceImpl.class, PasswordComparator.class }) @ComponentScan(basePackages = { "io.mosip.authentication.service.*", "io.mosip.kernel.core.logger.config", "io.mosip.authentication.common.service.config", "${mosip.auth.adapter.impl.basepackage}" }, excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = { "io.mosip.idrepository.core.config.IdRepoDataSourceConfig.*" })) diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/filter/KycAuthFilter.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/filter/KycAuthFilter.java index de11d4f2ebc..426f3824b39 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/filter/KycAuthFilter.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/filter/KycAuthFilter.java @@ -59,6 +59,8 @@ protected void checkAllowedAuthTypeBasedOnPolicy(Map requestBody if (AuthTypeUtil.isKeyBindedToken(kycAuthRequestDTO)) { super.checkAllowedAuthTypeForKeyBindedToken(requestBody, authPolicies); } + + super.checkAllowedAuthTypeForPassword(requestBody, authPolicies); } catch (IOException e) { throw new IdAuthenticationAppException(IdAuthenticationErrorConstants.UNABLE_TO_PROCESS, e); } diff --git a/authentication/pom.xml b/authentication/pom.xml index 7685d577e81..4cd905992a7 100644 --- a/authentication/pom.xml +++ b/authentication/pom.xml @@ -95,7 +95,7 @@ 1.2.1-SNAPSHOT ${kernel.parent.version} - 1.2.0.1-B3-SNAPSHOT + 1.2.1-SNAPSHOT ${kernel.parent.version} ${kernel.parent.version} ${kernel.parent.version}