Skip to content

Commit

Permalink
[ES-280], [ES-281] (#1094)
Browse files Browse the repository at this point in the history
* Corrected dependency versions.

* Fixed NotReadablePropertyException error and added VID or UIN in VC.
  • Loading branch information
mahammedtaheer authored Sep 15, 2023
1 parent e7b2053 commit 181e784
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -294,7 +297,7 @@ private JsonLDObject generateLdpVc(String credSubjectId, Map<String, List<Identi
List<String> locales, Set<String> allowedAttributes, VciExchangeRequestDTO vciExchangeRequestDTO,
String psuToken) throws IdAuthenticationBusinessException {

Map<String, Object> credSubjectMap = getCredSubjectMap(credSubjectId, idInfo, locales, allowedAttributes);
Map<String, Object> credSubjectMap = getCredSubjectMap(credSubjectId, idInfo, locales, allowedAttributes, vciExchangeRequestDTO);
try {
Map<String, Object> verCredJsonObject = new HashMap<>();

Expand Down Expand Up @@ -361,13 +364,18 @@ private JsonLDObject generateLdpVc(String credSubjectId, Map<String, List<Identi
}

private Map<String, Object> getCredSubjectMap(String credSubjectId, Map<String, List<IdentityInfoDTO>> idInfo,
List<String> locales, Set<String> allowedAttributes) throws IdAuthenticationBusinessException {
List<String> locales, Set<String> allowedAttributes, VciExchangeRequestDTO vciExchangeRequestDTO)
throws IdAuthenticationBusinessException {
Map<String, Object> credSubjectMap = new HashMap<>();

credSubjectMap.put(IdAuthCommonConstants.VC_ID, credSubjectId);

for (String attrib : allowedAttributes) {
List<String> idSchemaAttributes = idInfoHelper.getIdentityAttributesForIdName(attrib);
if (consentedIndividualAttributeName.equals(attrib)) {
credSubjectMap.put(vciExchangeRequestDTO.getIndividualIdType(), vciExchangeRequestDTO.getIndividualId());
continue;
}

if (attrib.equalsIgnoreCase(BiometricType.FACE.value())) {
Map<String, String> faceEntityInfoMap = idInfoHelper.getIdEntityInfoMap(BioMatchType.FACE, idInfo, null);
if (Objects.nonNull(faceEntityInfoMap)) {
Expand All @@ -382,7 +390,9 @@ private Map<String, Object> getCredSubjectMap(String credSubjectId, Map<String,
}

}
continue;
}
List<String> idSchemaAttributes = idInfoHelper.getIdentityAttributesForIdName(attrib);
for (String idSchemaAttribute : idSchemaAttributes) {
List<IdentityInfoDTO> idInfoList = idInfo.get(idSchemaAttribute);
if (Objects.isNull(idInfoList))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -150,16 +150,16 @@ private void validateVCFormat(String vcFormat, Errors errors, String paramName)
private void validateCredentialType(List<String> 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());
}
}
Expand Down
8 changes: 4 additions & 4 deletions authentication/esignet-integration-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@

<dependency>
<groupId>io.mosip.esignet</groupId>
<artifactId>esignet-integration-api</artifactId>
<version>1.2.1-SNAPSHOT</version>
<artifactId>esignet-core</artifactId>
<version>1.2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.mosip.esignet</groupId>
<artifactId>esignet-core</artifactId>
<version>1.2.1-SNAPSHOT</version>
<artifactId>esignet-integration-api</artifactId>
<version>1.2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand Down

0 comments on commit 181e784

Please sign in to comment.