Skip to content

Commit

Permalink
MOSIP-25748 debug logger added (#1660)
Browse files Browse the repository at this point in the history
* MOSIP-25748 debug comments added
  • Loading branch information
sowmya695 authored Feb 9, 2023
1 parent 904d47b commit 6bf0663
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.mosip.registration.processor.stages.uingenerator.stage;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
Expand Down Expand Up @@ -34,6 +35,7 @@
import io.mosip.kernel.core.logger.spi.Logger;
import io.mosip.kernel.core.util.CryptoUtil;
import io.mosip.kernel.core.util.DateUtils;
import io.mosip.kernel.core.util.HMACUtils2;
import io.mosip.kernel.core.util.StringUtils;
import io.mosip.registration.processor.core.abstractverticle.MessageBusAddress;
import io.mosip.registration.processor.core.abstractverticle.MessageDTO;
Expand Down Expand Up @@ -243,6 +245,14 @@ public MessageDTO process(MessageDTO object) {
idSchemaUtil.getDefaultFields(Double.valueOf(schemaVersion)), registrationStatusDto.getRegistrationType(), ProviderStageName.UIN_GENERATOR);
String uinField = fieldMap.get(utility.getMappingJsonValue(MappingJsonConstants.UIN, MappingJsonConstants.IDENTITY));

String dateOfBirth = fieldMap
.get(utility.getMappingJsonValue(MappingJsonConstants.DOB, MappingJsonConstants.IDENTITY));
if (dateOfBirth != null && !dateOfBirth.isEmpty()) {
regProcLogger.debug(LoggerFileConstant.SESSIONID.toString(),
LoggerFileConstant.REGISTRATIONID.toString(), registrationId,
"UinGeneratorStage::process()::Before calling ID-repo api date of birth hash: "
+ getHMACHashCode(dateOfBirth));
}
JSONObject demographicIdentity = new JSONObject();
demographicIdentity.put(MappingJsonConstants.IDSCHEMA_VERSION, convertIdschemaToDouble ? Double.valueOf(schemaVersion) : schemaVersion);

Expand Down Expand Up @@ -1291,6 +1301,12 @@ private boolean isPerpetualVidAlreadyPresent(String uin) throws ApisResourceAcce
}
return false;
}


public static String getHMACHashCode(String value) throws NoSuchAlgorithmException {
if (value == null)
return null;
return CryptoUtil.encodeBase64(HMACUtils2.generateHash(value.getBytes()));

}

}

0 comments on commit 6bf0663

Please sign in to comment.