From ebaa603b21cc0d900efbfbc84de1431bde11800f Mon Sep 17 00:00:00 2001 From: Mahammed Taheer Date: Tue, 12 Sep 2023 17:18:14 +0530 Subject: [PATCH 1/2] Corrected dependency versions. --- authentication/esignet-integration-impl/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/authentication/esignet-integration-impl/pom.xml b/authentication/esignet-integration-impl/pom.xml index f1966b52677..26483f32f48 100644 --- a/authentication/esignet-integration-impl/pom.xml +++ b/authentication/esignet-integration-impl/pom.xml @@ -35,15 +35,15 @@ io.mosip.esignet - esignet-integration-api - 1.2.1-SNAPSHOT + esignet-core + 1.2.1-SNAPSHOT provided io.mosip.esignet - esignet-core - 1.2.1-SNAPSHOT + esignet-integration-api + 1.2.1-SNAPSHOT provided From 7c676cc38695441a0d4b733d46130a4d3853e81a Mon Sep 17 00:00:00 2001 From: Mahammed Taheer Date: Fri, 15 Sep 2023 01:25:17 +0530 Subject: [PATCH 2/2] Fixed NotReadablePropertyException error and added VID or UIN in VC. --- .../core/constant/IdAuthCommonConstants.java | 2 ++ .../IdentityWalletBindingController.java | 2 +- .../service/kyc/facade/KycFacadeImpl.java | 4 ---- .../service/kyc/impl/VciServiceImpl.java | 18 ++++++++++++++---- .../validator/VciExchangeRequestValidator.java | 10 +++++----- 5 files changed, 22 insertions(+), 14 deletions(-) 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 bb6a7cfda95..3ef269091ac 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 @@ -443,6 +443,8 @@ public final class IdAuthCommonConstants { public static final String VCI_EXCHANGE_SUCCESS = "VciExchange status : true"; + public static final String VC_CREDENTIAL_DEF = "credentialsDefinition"; + private IdAuthCommonConstants() { } } diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/controller/IdentityWalletBindingController.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/controller/IdentityWalletBindingController.java index 4cb61d879fc..0fd191e4b1c 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/controller/IdentityWalletBindingController.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/controller/IdentityWalletBindingController.java @@ -147,7 +147,7 @@ public IdentityKeyBindingResponseDto processIdKeyBinding(@Validated @RequestBody metadata != null && metadata.get(IdAuthCommonConstants.IDENTITY_DATA) != null && metadata.get(IdAuthCommonConstants.IDENTITY_INFO) != null) { - keyBindingResponseDto = keyIdentityFacade.processIdentityKeyBinding(identityKeyBindingRequestDTO, authResponseDTO, + keyBindingResponseDto = keyIdentityFacade.processIdentityKeyBinding(identityKeyBindingRequestDTO, authResponseDTO, partnerId, oidcClientId, metadata); } return keyBindingResponseDto; diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/KycFacadeImpl.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/KycFacadeImpl.java index 2b94fa585ef..7e3582f9732 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/KycFacadeImpl.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/KycFacadeImpl.java @@ -3,7 +3,6 @@ */ package io.mosip.authentication.service.kyc.facade; -import java.time.LocalDateTime; import java.util.AbstractMap.SimpleEntry; import java.util.Collection; import java.util.HashSet; @@ -27,14 +26,11 @@ import io.mosip.authentication.common.service.builder.AuthTransactionBuilder; import io.mosip.authentication.common.service.entity.AutnTxn; import io.mosip.authentication.common.service.entity.KycTokenData; -import io.mosip.authentication.common.service.entity.OIDCClientData; import io.mosip.authentication.common.service.helper.AuditHelper; -import io.mosip.authentication.common.service.helper.IdInfoHelper; import io.mosip.authentication.common.service.helper.TokenValidationHelper; import io.mosip.authentication.common.service.integration.TokenIdManager; import io.mosip.authentication.common.service.repository.IdaUinHashSaltRepo; import io.mosip.authentication.common.service.repository.KycTokenDataRepository; -import io.mosip.authentication.common.service.repository.OIDCClientDataRepository; import io.mosip.authentication.common.service.transaction.manager.IdAuthSecurityManager; import io.mosip.authentication.common.service.util.EnvUtil; import io.mosip.authentication.common.service.util.IdaRequestResponsConsumerUtil; diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/impl/VciServiceImpl.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/impl/VciServiceImpl.java index 3ab63ba2433..73095681daf 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/impl/VciServiceImpl.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/impl/VciServiceImpl.java @@ -89,6 +89,9 @@ public class VciServiceImpl implements VciService { OBJECT_MAPPER.registerModule(new AfterburnerModule()); } + @Value("${ida.idp.consented.individual_id.attribute.name:individual_id}") + private String consentedIndividualAttributeName; + @Value("${mosip.ida.config.server.file.storage.uri:}") private String configServerFileStorageUrl; @@ -294,7 +297,7 @@ private JsonLDObject generateLdpVc(String credSubjectId, Map locales, Set allowedAttributes, VciExchangeRequestDTO vciExchangeRequestDTO, String psuToken) throws IdAuthenticationBusinessException { - Map credSubjectMap = getCredSubjectMap(credSubjectId, idInfo, locales, allowedAttributes); + Map credSubjectMap = getCredSubjectMap(credSubjectId, idInfo, locales, allowedAttributes, vciExchangeRequestDTO); try { Map verCredJsonObject = new HashMap<>(); @@ -361,13 +364,18 @@ private JsonLDObject generateLdpVc(String credSubjectId, Map getCredSubjectMap(String credSubjectId, Map> idInfo, - List locales, Set allowedAttributes) throws IdAuthenticationBusinessException { + List locales, Set allowedAttributes, VciExchangeRequestDTO vciExchangeRequestDTO) + throws IdAuthenticationBusinessException { Map credSubjectMap = new HashMap<>(); credSubjectMap.put(IdAuthCommonConstants.VC_ID, credSubjectId); - + for (String attrib : allowedAttributes) { - List idSchemaAttributes = idInfoHelper.getIdentityAttributesForIdName(attrib); + if (consentedIndividualAttributeName.equals(attrib)) { + credSubjectMap.put(vciExchangeRequestDTO.getIndividualIdType(), vciExchangeRequestDTO.getIndividualId()); + continue; + } + if (attrib.equalsIgnoreCase(BiometricType.FACE.value())) { Map faceEntityInfoMap = idInfoHelper.getIdEntityInfoMap(BioMatchType.FACE, idInfo, null); if (Objects.nonNull(faceEntityInfoMap)) { @@ -382,7 +390,9 @@ private Map getCredSubjectMap(String credSubjectId, Map idSchemaAttributes = idInfoHelper.getIdentityAttributesForIdName(attrib); for (String idSchemaAttribute : idSchemaAttributes) { List idInfoList = idInfo.get(idSchemaAttribute); if (Objects.isNull(idInfoList)) diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/validator/VciExchangeRequestValidator.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/validator/VciExchangeRequestValidator.java index 44f81ce6b63..a2005c8fb34 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/validator/VciExchangeRequestValidator.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/validator/VciExchangeRequestValidator.java @@ -104,7 +104,7 @@ public void validate(Object target, Errors errors) { } if (!errors.hasErrors()) { - validateCredentialType(vciExchangeRequestDTO.getCredentialsDefinition().getType(), errors, IdAuthCommonConstants.VC_CREDENTIAL_TYPE); + validateCredentialType(vciExchangeRequestDTO.getCredentialsDefinition().getType(), errors, IdAuthCommonConstants.VC_CREDENTIAL_DEF); } } else { @@ -150,16 +150,16 @@ private void validateVCFormat(String vcFormat, Errors errors, String paramName) private void validateCredentialType(List credentialType, Errors errors, String paramName) { if (credentialType == null || credentialType.isEmpty()) { mosipLogger.error(SESSION_ID, this.getClass().getSimpleName(), VALIDATE, - MISSING_INPUT_PARAMETER + paramName); + MISSING_INPUT_PARAMETER + paramName + "/type" ); errors.rejectValue(paramName, IdAuthenticationErrorConstants.MISSING_INPUT_PARAMETER.getErrorCode(), - new Object[] { paramName }, + new Object[] { paramName + "/type" }, IdAuthenticationErrorConstants.MISSING_INPUT_PARAMETER.getErrorMessage()); } else { if(!supportedCredTypes.containsAll(credentialType)) { mosipLogger.error(SESSION_ID, this.getClass().getSimpleName(), VALIDATE, - MISSING_INPUT_PARAMETER + paramName); + MISSING_INPUT_PARAMETER + paramName + "/type" ); errors.rejectValue(paramName, IdAuthenticationErrorConstants.INVALID_INPUT_PARAMETER.getErrorCode(), - new Object[] { paramName }, + new Object[] { paramName + "/type" }, IdAuthenticationErrorConstants.INVALID_INPUT_PARAMETER.getErrorMessage()); } }