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 c95f38bea78..3a3b27878cf 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 @@ -402,7 +402,7 @@ private void processDemoAuth(AuthRequestDTO authRequestDTO, Map auditRequest = auditFactory.buildRequest(module, event, id, idType, desc); - RestRequestDTO restRequest = restFactory.buildRequest(RestServicesConstants.AUDIT_MANAGER_SERVICE, auditRequest, - Map.class); - restHelper.requestAsync(restRequest); - } - - /** - * Method to build audit error scenarios and send it to audit service. - * - * @param module {@link AuditModules} - * @param event {@link AuditEvents} - * @param id UIN/VID - * @param idType {@link IdType} enum - * @param desc the desc - * @throws IDDataValidationException the ID data validation exception - */ - public void audit(AuditModules module, AuditEvents event, String id, IdType idType, IdAuthenticationBaseException e) - throws IDDataValidationException { - audit(module, event, id, idType.name(), e); - } - - /** - * Method to build audit error scenarios and send it to audit service. - * - * @param module {@link AuditModules} - * @param event {@link AuditEvents} - * @param id UIN/VID - * @param idType {@link IdType} name - * @param desc the desc - * @throws IDDataValidationException the ID data validation exception - */ - public void audit(AuditModules module, AuditEvents event, String id, String idType, IdAuthenticationBaseException e) - throws IDDataValidationException { - List errorList = IdAuthExceptionHandler.getAuthErrors(e); - String error; - try { - error = mapper.writeValueAsString(errorList); - } catch (JsonProcessingException e1) { - //Probably will not occur - error = "Error : " + e.getErrorCode() + " - " + e.getErrorText(); - } - audit(module, event, id, idType, error); - } - - public void auditExceptionForAuthRequestedModules(AuditEvents authAuditEvent, AuthRequestDTO authRequestDTO, - IdAuthenticationBaseException e) throws IDDataValidationException { - List auditModules = getAuditModules(authRequestDTO); - for (AuditModules auditModule : auditModules) { - audit(auditModule, authAuditEvent, authRequestDTO.getIndividualId(), authRequestDTO.getIndividualIdType(), - e); - } - } - - public void auditStatusForAuthRequestedModules(AuditEvents authAuditEvent, AuthRequestDTO authRequestDTO, - String status) throws IDDataValidationException { - List auditModules = getAuditModules(authRequestDTO); - for (AuditModules auditModule : auditModules) { - audit(auditModule, authAuditEvent, authRequestDTO.getIndividualId(), authRequestDTO.getIndividualIdType(), - status); - } - } - - private List getAuditModules(AuthRequestDTO authRequestDTO) { - List auditModules = new ArrayList<>(5); - if (AuthTypeUtil.isOtp(authRequestDTO)) { - auditModules.add(AuditModules.OTP_AUTH); - } - - if (AuthTypeUtil.isDemo(authRequestDTO)) { - auditModules.add(AuditModules.DEMO_AUTH); - } - - if (AuthTypeUtil.isPin(authRequestDTO)) { - auditModules.add(AuditModules.PIN_AUTH); - } - - if (AuthTypeUtil.isBio(authRequestDTO)) { - if (authRequestDTO.getRequest() != null && authRequestDTO.getRequest().getBiometrics() != null) { - if ((authRequestDTO.getRequest().getBiometrics().stream().map(BioIdentityInfoDTO::getData).anyMatch( - bioInfo -> BioAuthType.FGR_IMG.getType().equals(bioInfo.getBioType()) || (EnvUtil.getIsFmrEnabled() - && BioAuthType.FGR_MIN.getType().equals(bioInfo.getBioType()))))) { - auditModules.add(AuditModules.FINGERPRINT_AUTH); - } - - if (authRequestDTO.getRequest().getBiometrics().stream().map(BioIdentityInfoDTO::getData) - .anyMatch(bioInfo -> BioAuthType.IRIS_IMG.getType().equals(bioInfo.getBioType()))) { - auditModules.add(AuditModules.IRIS_AUTH); - } - - if (authRequestDTO.getRequest().getBiometrics().stream().map(BioIdentityInfoDTO::getData) - .anyMatch(bioInfo -> BioAuthType.FACE_IMG.getType().equals(bioInfo.getBioType()))) { - auditModules.add(AuditModules.FACE_AUTH); - } - } - } - return auditModules; - } - -} +package io.mosip.authentication.common.service.helper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.mosip.authentication.common.service.exception.IdAuthExceptionHandler; +import io.mosip.authentication.common.service.factory.AuditRequestFactory; +import io.mosip.authentication.common.service.factory.RestRequestFactory; +import io.mosip.authentication.common.service.impl.match.BioAuthType; +import io.mosip.authentication.common.service.util.AuthTypeUtil; +import io.mosip.authentication.common.service.util.EnvUtil; +import io.mosip.authentication.core.constant.AuditEvents; +import io.mosip.authentication.core.constant.AuditModules; +import io.mosip.authentication.core.constant.RestServicesConstants; +import io.mosip.authentication.core.dto.AuditRequestDto; +import io.mosip.authentication.core.exception.IDDataValidationException; +import io.mosip.authentication.core.exception.IdAuthenticationBaseException; +import io.mosip.authentication.core.indauth.dto.AuthError; +import io.mosip.authentication.core.indauth.dto.AuthRequestDTO; +import io.mosip.authentication.core.indauth.dto.BioIdentityInfoDTO; +import io.mosip.authentication.core.indauth.dto.IdType; +import io.mosip.idrepository.core.dto.RestRequestDTO; +import io.mosip.idrepository.core.helper.RestHelper; +import io.mosip.kernel.core.http.RequestWrapper; + +/** + * The Class AuditHelper - build audit requests and send it to audit service. + * + * @author Manoj SP + */ +@Component +public class AuditHelper { + + /** The rest helper. */ + @Autowired + @Qualifier("withSelfTokenWebclient") + private RestHelper restHelper; + + /** The audit factory. */ + @Autowired + private AuditRequestFactory auditFactory; + + /** The rest factory. */ + @Autowired + private RestRequestFactory restFactory; + + @Autowired + private ObjectMapper mapper; + + /** The EnvPropertyResolver */ + @Autowired + private EnvUtil env; + + + /** + * Method to build audit requests and send it to audit service. + * + * @param module {@link AuditModules} + * @param event {@link AuditEvents} + * @param id UIN/VID + * @param idType {@link IdType} enum + * @param desc the desc + * @throws IDDataValidationException the ID data validation exception + */ + public void audit(AuditModules module, AuditEvents event, String id, IdType idType, String desc) + throws IDDataValidationException { + audit(module, event, id, idType.name(), desc); + } + + /** + * Method to build audit requests and send it to audit service. + * + * @param module {@link AuditModules} + * @param event {@link AuditEvents} + * @param id UIN/VID + * @param idType {@link IdType} name + * @param desc the desc + * @throws IDDataValidationException the ID data validation exception + */ + public void audit(AuditModules module, AuditEvents event, String id, String idType, String desc) + throws IDDataValidationException { + RequestWrapper auditRequest = auditFactory.buildRequest(module, event, id, idType, desc); + RestRequestDTO restRequest = restFactory.buildRequest(RestServicesConstants.AUDIT_MANAGER_SERVICE, auditRequest, + Map.class); + restHelper.requestAsync(restRequest); + } + + /** + * Method to build audit error scenarios and send it to audit service. + * + * @param module {@link AuditModules} + * @param event {@link AuditEvents} + * @param id UIN/VID + * @param idType {@link IdType} enum + * @param desc the desc + * @throws IDDataValidationException the ID data validation exception + */ + public void audit(AuditModules module, AuditEvents event, String id, IdType idType, IdAuthenticationBaseException e) + throws IDDataValidationException { + audit(module, event, id, idType.name(), e); + } + + /** + * Method to build audit error scenarios and send it to audit service. + * + * @param module {@link AuditModules} + * @param event {@link AuditEvents} + * @param id UIN/VID + * @param idType {@link IdType} name + * @param desc the desc + * @throws IDDataValidationException the ID data validation exception + */ + public void audit(AuditModules module, AuditEvents event, String id, String idType, IdAuthenticationBaseException e) + throws IDDataValidationException { + List errorList = IdAuthExceptionHandler.getAuthErrors(e); + String error; + try { + error = mapper.writeValueAsString(errorList); + } catch (JsonProcessingException e1) { + //Probably will not occur + error = "Error : " + e.getErrorCode() + " - " + e.getErrorText(); + } + audit(module, event, id, idType, error); + } + + public void auditExceptionForAuthRequestedModules(AuditEvents authAuditEvent, AuthRequestDTO authRequestDTO, + IdAuthenticationBaseException e) throws IDDataValidationException { + List auditModules = getAuditModules(authRequestDTO); + for (AuditModules auditModule : auditModules) { + audit(auditModule, authAuditEvent, authRequestDTO.getTransactionID(), authRequestDTO.getIndividualIdType(), + e); + } + } + + public void auditStatusForAuthRequestedModules(AuditEvents authAuditEvent, AuthRequestDTO authRequestDTO, + String status) throws IDDataValidationException { + List auditModules = getAuditModules(authRequestDTO); + for (AuditModules auditModule : auditModules) { + audit(auditModule, authAuditEvent, authRequestDTO.getTransactionID(), authRequestDTO.getIndividualIdType(), + status); + } + } + + private List getAuditModules(AuthRequestDTO authRequestDTO) { + List auditModules = new ArrayList<>(5); + if (AuthTypeUtil.isOtp(authRequestDTO)) { + auditModules.add(AuditModules.OTP_AUTH); + } + + if (AuthTypeUtil.isDemo(authRequestDTO)) { + auditModules.add(AuditModules.DEMO_AUTH); + } + + if (AuthTypeUtil.isPin(authRequestDTO)) { + auditModules.add(AuditModules.PIN_AUTH); + } + + if (AuthTypeUtil.isBio(authRequestDTO)) { + if (authRequestDTO.getRequest() != null && authRequestDTO.getRequest().getBiometrics() != null) { + if ((authRequestDTO.getRequest().getBiometrics().stream().map(BioIdentityInfoDTO::getData).anyMatch( + bioInfo -> BioAuthType.FGR_IMG.getType().equals(bioInfo.getBioType()) || (EnvUtil.getIsFmrEnabled() + && BioAuthType.FGR_MIN.getType().equals(bioInfo.getBioType()))))) { + auditModules.add(AuditModules.FINGERPRINT_AUTH); + } + + if (authRequestDTO.getRequest().getBiometrics().stream().map(BioIdentityInfoDTO::getData) + .anyMatch(bioInfo -> BioAuthType.IRIS_IMG.getType().equals(bioInfo.getBioType()))) { + auditModules.add(AuditModules.IRIS_AUTH); + } + + if (authRequestDTO.getRequest().getBiometrics().stream().map(BioIdentityInfoDTO::getData) + .anyMatch(bioInfo -> BioAuthType.FACE_IMG.getType().equals(bioInfo.getBioType()))) { + auditModules.add(AuditModules.FACE_AUTH); + } + } + } + + if (AuthTypeUtil.isKeyBindedToken(authRequestDTO)) { + auditModules.add(AuditModules.TOKEN_AUTH); + } + + if (AuthTypeUtil.isPassword(authRequestDTO)) { + auditModules.add(AuditModules.PASSWORD_AUTH); + } + return auditModules; + } + +} diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/MispLicenseDataRepository.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/MispLicenseDataRepository.java index e2fc5039bbe..3ce5c9844f7 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/MispLicenseDataRepository.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/MispLicenseDataRepository.java @@ -1,13 +1,20 @@ package io.mosip.authentication.common.service.repository; +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.MISP_LIC_DATA; + import java.util.Optional; +import org.springframework.cache.annotation.Cacheable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import io.mosip.authentication.common.service.entity.MispLicenseData; public interface MispLicenseDataRepository extends JpaRepository { - Optional findByLicenseKey(String licenseKey); + @Cacheable(value = MISP_LIC_DATA, unless ="#result == null") + @Query("select ml from MispLicenseData ml where ml.licenseKey = :licenseKey") + Optional findByLicenseKey(@Param("licenseKey") String licenseKey); } diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java index f4b6143408b..8bb3e9bbe42 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java @@ -21,7 +21,7 @@ @Repository public interface OIDCClientDataRepository extends JpaRepository { - @Cacheable(value = OIDC_CLIENT_DATA, key="#oidc_client_id", condition="#oidc_client_id!=null") + @Cacheable(value = OIDC_CLIENT_DATA, unless ="#result == null") @Query("select oi from OIDCClientData oi where oi.clientId = :clientId") Optional findByClientId(@Param("clientId") String clientId); } diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerDataRepository.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerDataRepository.java index 968ebfc97da..6823f120100 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerDataRepository.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerDataRepository.java @@ -1,12 +1,19 @@ package io.mosip.authentication.common.service.repository; +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.PARTNER_DATA; + import java.util.Optional; +import org.springframework.cache.annotation.Cacheable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import io.mosip.authentication.common.service.entity.PartnerData; public interface PartnerDataRepository extends JpaRepository { - Optional findByPartnerId(String partnerId); + @Cacheable(value = PARTNER_DATA, unless ="#result == null") + @Query("select pd from PartnerData pd where pd.partnerId = :partnerId") + Optional findByPartnerId(@Param("partnerId") String partnerId); } diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerMappingRepository.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerMappingRepository.java index 0484d26bf67..9a7afa81119 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerMappingRepository.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PartnerMappingRepository.java @@ -1,16 +1,25 @@ package io.mosip.authentication.common.service.repository; +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.PARTNER_API_KEY_DATA; +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.PARTNER_API_KEY_POLICY_ID_DATA; + import java.util.Optional; +import org.springframework.cache.annotation.Cacheable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import io.mosip.authentication.common.service.entity.PartnerMapping; public interface PartnerMappingRepository extends JpaRepository { - Optional findByPartnerIdAndApiKeyId(String partnerId, String apiKeyId); - - Optional findByPartnerId(String partnerId); + @Cacheable(value = PARTNER_API_KEY_DATA, unless ="#result == null") + @Query("select pm from PartnerMapping pm where pm.partnerId = :partnerId and pm.apiKeyId = :apiKeyId") + Optional findByPartnerIdAndApiKeyId(@Param("partnerId") String partnerId, @Param("apiKeyId") String apiKeyId); - Optional findByPartnerIdAndApiKeyIdAndPolicyId(String partnerId, String apiKeyId, String policyId); + @Cacheable(value = PARTNER_API_KEY_POLICY_ID_DATA, unless ="#result == null") + @Query("select pm from PartnerMapping pm where pm.partnerId = :partnerId and pm.apiKeyId = :apiKeyId and pm.policyId = :policyId") + Optional findByPartnerIdAndApiKeyIdAndPolicyId(@Param("partnerId") String partnerId, @Param("apiKeyId") String apiKeyId, + @Param("policyId") String policyId); } diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PolicyDataRepository.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PolicyDataRepository.java index 06dbdeac426..fd883390f4d 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PolicyDataRepository.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/PolicyDataRepository.java @@ -1,13 +1,20 @@ package io.mosip.authentication.common.service.repository; +import static io.mosip.authentication.core.constant.IdAuthCommonConstants.POLICY_DATA; + import java.util.Optional; +import org.springframework.cache.annotation.Cacheable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import io.mosip.authentication.common.service.entity.PolicyData; public interface PolicyDataRepository extends JpaRepository { - Optional findByPolicyId(String policyId); + @Cacheable(value = POLICY_DATA, unless ="#result == null") + @Query("select pd from PolicyData pd where pd.policyId = :policyId") + Optional findByPolicyId(@Param("policyId") String policyId); } 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 94f2e1ea739..5075a446a6f 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 @@ -455,6 +455,16 @@ public final class IdAuthCommonConstants { public static final String OIDC_CLIENT_DATA = "oidc_client_data"; + public static final String PARTNER_API_KEY_DATA = "partner_api_key_data"; + + public static final String PARTNER_API_KEY_POLICY_ID_DATA = "partner_api_key_policy_id_data"; + + public static final String PARTNER_DATA = "partner_data"; + + public static final String POLICY_DATA = "policy_data"; + + public static final String MISP_LIC_DATA = "misp_lic_data"; + private IdAuthCommonConstants() { } } diff --git a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalAuthTxnController.java b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalAuthTxnController.java index 1c8b844cee4..6eb73ca1b19 100644 --- a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalAuthTxnController.java +++ b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalAuthTxnController.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.Objects; import java.util.TimeZone; +import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -23,7 +24,6 @@ import org.springframework.web.bind.annotation.RestController; import io.mosip.authentication.common.service.helper.AuditHelper; -import io.mosip.authentication.common.service.transaction.manager.IdAuthSecurityManager; import io.mosip.authentication.common.service.util.EnvUtil; import io.mosip.authentication.core.autntxn.dto.AutnTxnDto; import io.mosip.authentication.core.autntxn.dto.AutnTxnRequestDto; @@ -74,9 +74,6 @@ public class InternalAuthTxnController { @Autowired private AuditHelper auditHelper; - @Autowired - private IdAuthSecurityManager securityManager; - @InitBinder public void initBinder(WebDataBinder binder) { binder.setValidator(authTxnValidator); @@ -124,8 +121,9 @@ public ResponseEntity getAuthTxnDetails( Objects.isNull(individualIdType) ? idTypeUtil.getIdType(individualId).getType() : individualIdType); authtxnrequestdto.setPageStart(pageStart); authtxnrequestdto.setPageFetch(pageFetch); - String idvidHash = securityManager.hash(individualId); - + // Removed Storing the idvid hash value in audit entries. + // For this type of request storing a UUID instead of idvid hash. + String randomId = UUID.randomUUID().toString(); try { Errors errors = new BindException(authtxnrequestdto, "authtxnrequestdto"); authTxnValidator.validate(authtxnrequestdto, errors); @@ -137,20 +135,20 @@ public ResponseEntity getAuthTxnDetails( autnTxnResponseDto.setResponseTime(getResponseTime()); boolean status = true; - auditHelper.audit(AuditModules.AUTH_TRANSACTION_HISTORY, AuditEvents.RETRIEVE_AUTH_TRANSACTION_HISTORY_REQUEST_RESPONSE, idvidHash, + auditHelper.audit(AuditModules.AUTH_TRANSACTION_HISTORY, AuditEvents.RETRIEVE_AUTH_TRANSACTION_HISTORY_REQUEST_RESPONSE, randomId, IdType.getIDTypeOrDefault(authtxnrequestdto.getIndividualIdType()), "auth transaction history status : " + status ); return new ResponseEntity<>(autnTxnResponseDto, HttpStatus.OK); } catch (IDDataValidationException e) { logger.error(IdAuthCommonConstants.SESSION_ID, this.getClass().getSimpleName(), AUTH_TXN_DETAILS, e.getErrorText()); - auditHelper.audit(AuditModules.AUTH_TRANSACTION_HISTORY, AuditEvents.RETRIEVE_AUTH_TRANSACTION_HISTORY_REQUEST_RESPONSE, idvidHash, + auditHelper.audit(AuditModules.AUTH_TRANSACTION_HISTORY, AuditEvents.RETRIEVE_AUTH_TRANSACTION_HISTORY_REQUEST_RESPONSE, randomId, IdType.getIDTypeOrDefault(authtxnrequestdto.getIndividualIdType()), e ); throw new IdAuthenticationAppException(IdAuthenticationErrorConstants.DATA_VALIDATION_FAILED, e); } catch (IdAuthenticationBusinessException e) { logger.error(IdAuthCommonConstants.SESSION_ID, e.getClass().toString(), e.getErrorCode(), e.getErrorText()); - auditHelper.audit(AuditModules.AUTH_TRANSACTION_HISTORY, AuditEvents.RETRIEVE_AUTH_TRANSACTION_HISTORY_REQUEST_RESPONSE, idvidHash, + auditHelper.audit(AuditModules.AUTH_TRANSACTION_HISTORY, AuditEvents.RETRIEVE_AUTH_TRANSACTION_HISTORY_REQUEST_RESPONSE, randomId, IdType.getIDTypeOrDefault(authtxnrequestdto.getIndividualIdType()), e ); throw new IdAuthenticationAppException(e.getErrorCode(), e.getErrorText(), e); } diff --git a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalOTPController.java b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalOTPController.java index f9c29fef54e..2e60506a41f 100644 --- a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalOTPController.java +++ b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalOTPController.java @@ -122,7 +122,7 @@ public OtpResponseDTO generateOTP(@Valid @RequestBody OtpRequestDTO otpRequestDt Optional partner = Optional.empty(); AuthTransactionBuilder authTxnBuilder = authTransactionHelper .createAndSetAuthTxnBuilderMetadataToRequest(otpRequestDto, !isPartnerReq, partner); - String idvidHash = securityManager.hash(otpRequestDto.getIndividualId()); + try { String idType = Objects.nonNull(otpRequestDto.getIndividualIdType()) ? otpRequestDto.getIndividualIdType() : idTypeUtil.getIdType(otpRequestDto.getIndividualId()).getType(); @@ -134,20 +134,20 @@ public OtpResponseDTO generateOTP(@Valid @RequestBody OtpRequestDTO otpRequestDt otpResponseDTO.getResponseTime()); boolean status = otpResponseDTO.getErrors() == null || otpResponseDTO.getErrors().isEmpty(); - auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.INTERNAL_OTP_TRIGGER_REQUEST_RESPONSE, idvidHash, + auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.INTERNAL_OTP_TRIGGER_REQUEST_RESPONSE, otpRequestDto.getTransactionID(), IdType.getIDTypeOrDefault(otpRequestDto.getIndividualIdType()), "Internal OTP Request status : " + status); return otpResponseDTO; } catch (IDDataValidationException e) { logger.error(IdAuthCommonConstants.SESSION_ID, this.getClass().getSimpleName(), GENERATE_OTP, e.getErrorText()); - auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.INTERNAL_OTP_TRIGGER_REQUEST_RESPONSE, idvidHash, + auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.INTERNAL_OTP_TRIGGER_REQUEST_RESPONSE, otpRequestDto.getTransactionID(), IdType.getIDTypeOrDefault(otpRequestDto.getIndividualIdType()), e); IdaRequestResponsConsumerUtil.setIdVersionToObjectWithMetadata(requestWithMetadata, e); e.putMetadata(IdAuthCommonConstants.TRANSACTION_ID, otpRequestDto.getTransactionID()); throw authTransactionHelper.createDataValidationException(authTxnBuilder, e, requestWithMetadata); } catch (IdAuthenticationBusinessException e) { logger.error(IdAuthCommonConstants.SESSION_ID, e.getClass().toString(), e.getErrorCode(), e.getErrorText()); - auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.INTERNAL_OTP_TRIGGER_REQUEST_RESPONSE, idvidHash, + auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.INTERNAL_OTP_TRIGGER_REQUEST_RESPONSE, otpRequestDto.getTransactionID(), IdType.getIDTypeOrDefault(otpRequestDto.getIndividualIdType()), e); authTransactionHelper.setAuthTransactionEntityMetadata(requestWithMetadata, authTxnBuilder); IdaRequestResponsConsumerUtil.setIdVersionToObjectWithMetadata(requestWithMetadata, e); diff --git a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalUpdateAuthTypeController.java b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalUpdateAuthTypeController.java index 0816149e4c8..4c6e23cccea 100644 --- a/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalUpdateAuthTypeController.java +++ b/authentication/authentication-internal-service/src/main/java/io/mosip/authentication/internal/service/controller/InternalUpdateAuthTypeController.java @@ -1,98 +1,98 @@ -package io.mosip.authentication.internal.service.controller; - -import static io.mosip.authentication.core.constant.IdAuthConfigKeyConstants.IDA_WEBSUB_AUTHTYPE_CALLBACK_SECRET; - -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.enums.ParameterIn; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import io.mosip.authentication.common.service.helper.AuditHelper; -import io.mosip.authentication.core.constant.AuditEvents; -import io.mosip.authentication.core.constant.AuditModules; -import io.mosip.authentication.core.constant.IdAuthCommonConstants; -import io.mosip.authentication.core.exception.IDDataValidationException; -import io.mosip.authentication.core.exception.IdAuthenticationAppException; -import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; -import io.mosip.authentication.core.indauth.dto.IdType; -import io.mosip.authentication.core.logger.IdaLogger; -import io.mosip.authentication.core.spi.authtype.status.service.UpdateAuthtypeStatusService; -import io.mosip.idrepository.core.dto.AuthTypeStatusEventDTO; -import io.mosip.kernel.core.logger.spi.Logger; -import io.mosip.kernel.core.websub.model.EventModel; -import io.mosip.kernel.core.websub.spi.SubscriptionClient; -import io.mosip.kernel.websub.api.annotation.PreAuthenticateContentAndVerifyIntent; -import io.mosip.kernel.websub.api.model.SubscriptionChangeRequest; -import io.mosip.kernel.websub.api.model.SubscriptionChangeResponse; -import io.mosip.kernel.websub.api.model.UnsubscriptionRequest; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; - -/** - * The InternalUpdateAuthTypeController use to fetch Auth Transaction. - * - * @author Dinesh Karuppiah.T - */ -@RestController -@Tag(name = "internal-update-auth-type-controller", description = "Internal Update Auth Type Controller") -public class InternalUpdateAuthTypeController { - - /** The logger. */ - private static Logger logger = IdaLogger.getLogger(InternalUpdateAuthTypeController.class); - - @Autowired - private UpdateAuthtypeStatusService authtypeStatusService; - - @Autowired - private AuditHelper auditHelper; - - @Autowired - private ObjectMapper mapper; - - @Autowired - @Qualifier("subscriptionExtendedClient") - SubscriptionClient subscribe; - - @PostMapping(value = "/callback/authTypeCallback/{partnerId}", consumes = "application/json") - @Operation(summary = "updateAuthtypeStatus", description = "updateAuthtypeStatus", tags = { "internal-update-auth-type-controller" }) - - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) - @PreAuthenticateContentAndVerifyIntent(secret = "${"+ IDA_WEBSUB_AUTHTYPE_CALLBACK_SECRET +"}", callback = "${ida-websub-auth-type-callback-relative-url}", topic = "${ida-topic-auth-type-status-updated}") - public void updateAuthtypeStatus(@RequestBody EventModel eventModel, @PathVariable("partnerId") String partnerId) - throws IdAuthenticationAppException, IDDataValidationException { - if(eventModel.getEvent() != null && eventModel.getEvent().getData() != null) { - AuthTypeStatusEventDTO event = mapper.convertValue(eventModel.getEvent().getData(), AuthTypeStatusEventDTO.class); - try { - logger.debug(IdAuthCommonConstants.SESSION_ID, "updateAuthtypeStatus", this.getClass().getCanonicalName(), "handling updateAuthtypeStatus event for partnerId: " + partnerId); - - authtypeStatusService.updateAuthTypeStatus(event.getTokenId(), event.getAuthTypeStatusList()); - - auditHelper.audit(AuditModules.AUTH_TYPE_STATUS, AuditEvents.UPDATE_AUTH_TYPE_STATUS_REQUEST_RESPONSE, - event.getTokenId(), IdType.UIN, "internal auth type status update status : " + true); - } catch (IdAuthenticationBusinessException e) { - logger.error(IdAuthCommonConstants.SESSION_ID, e.getClass().toString(), e.getErrorCode(), e.getErrorText()); - auditHelper.audit(AuditModules.AUTH_TYPE_STATUS, AuditEvents.UPDATE_AUTH_TYPE_STATUS_REQUEST_RESPONSE, - event.getTokenId(), IdType.UIN, e); - throw new IdAuthenticationAppException(e.getErrorCode(), e.getErrorText(), e); - } - } - - } - -} +package io.mosip.authentication.internal.service.controller; + +import static io.mosip.authentication.core.constant.IdAuthConfigKeyConstants.IDA_WEBSUB_AUTHTYPE_CALLBACK_SECRET; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.mosip.authentication.common.service.helper.AuditHelper; +import io.mosip.authentication.core.constant.AuditEvents; +import io.mosip.authentication.core.constant.AuditModules; +import io.mosip.authentication.core.constant.IdAuthCommonConstants; +import io.mosip.authentication.core.exception.IDDataValidationException; +import io.mosip.authentication.core.exception.IdAuthenticationAppException; +import io.mosip.authentication.core.exception.IdAuthenticationBusinessException; +import io.mosip.authentication.core.indauth.dto.IdType; +import io.mosip.authentication.core.logger.IdaLogger; +import io.mosip.authentication.core.spi.authtype.status.service.UpdateAuthtypeStatusService; +import io.mosip.idrepository.core.dto.AuthTypeStatusEventDTO; +import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.core.websub.model.EventModel; +import io.mosip.kernel.core.websub.spi.SubscriptionClient; +import io.mosip.kernel.websub.api.annotation.PreAuthenticateContentAndVerifyIntent; +import io.mosip.kernel.websub.api.model.SubscriptionChangeRequest; +import io.mosip.kernel.websub.api.model.SubscriptionChangeResponse; +import io.mosip.kernel.websub.api.model.UnsubscriptionRequest; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; + +/** + * The InternalUpdateAuthTypeController use to fetch Auth Transaction. + * + * @author Dinesh Karuppiah.T + */ +@RestController +@Tag(name = "internal-update-auth-type-controller", description = "Internal Update Auth Type Controller") +public class InternalUpdateAuthTypeController { + + /** The logger. */ + private static Logger logger = IdaLogger.getLogger(InternalUpdateAuthTypeController.class); + + @Autowired + private UpdateAuthtypeStatusService authtypeStatusService; + + @Autowired + private AuditHelper auditHelper; + + @Autowired + private ObjectMapper mapper; + + @Autowired + @Qualifier("subscriptionExtendedClient") + SubscriptionClient subscribe; + + @PostMapping(value = "/callback/authTypeCallback/{partnerId}", consumes = "application/json") + @Operation(summary = "updateAuthtypeStatus", description = "updateAuthtypeStatus", tags = { "internal-update-auth-type-controller" }) + + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "201", description = "Created" ,content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) + @PreAuthenticateContentAndVerifyIntent(secret = "${"+ IDA_WEBSUB_AUTHTYPE_CALLBACK_SECRET +"}", callback = "${ida-websub-auth-type-callback-relative-url}", topic = "${ida-topic-auth-type-status-updated}") + public void updateAuthtypeStatus(@RequestBody EventModel eventModel, @PathVariable("partnerId") String partnerId) + throws IdAuthenticationAppException, IDDataValidationException { + if(eventModel.getEvent() != null && eventModel.getEvent().getData() != null) { + AuthTypeStatusEventDTO event = mapper.convertValue(eventModel.getEvent().getData(), AuthTypeStatusEventDTO.class); + try { + logger.debug(IdAuthCommonConstants.SESSION_ID, "updateAuthtypeStatus", this.getClass().getCanonicalName(), "handling updateAuthtypeStatus event for partnerId: " + partnerId); + + authtypeStatusService.updateAuthTypeStatus(event.getTokenId(), event.getAuthTypeStatusList()); + + auditHelper.audit(AuditModules.AUTH_TYPE_STATUS, AuditEvents.UPDATE_AUTH_TYPE_STATUS_REQUEST_RESPONSE, + eventModel.getEvent().getId(), IdType.UIN, "internal auth type status update status : " + true); + } catch (IdAuthenticationBusinessException e) { + logger.error(IdAuthCommonConstants.SESSION_ID, e.getClass().toString(), e.getErrorCode(), e.getErrorText()); + auditHelper.audit(AuditModules.AUTH_TYPE_STATUS, AuditEvents.UPDATE_AUTH_TYPE_STATUS_REQUEST_RESPONSE, + eventModel.getEvent().getId(), IdType.UIN, e); + throw new IdAuthenticationAppException(e.getErrorCode(), e.getErrorText(), e); + } + } + + } + +} diff --git a/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/controller/OTPController.java b/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/controller/OTPController.java index a448558651a..010b1d08556 100644 --- a/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/controller/OTPController.java +++ b/authentication/authentication-otp-service/src/main/java/io/mosip/authentication/otp/service/controller/OTPController.java @@ -142,20 +142,20 @@ public OtpResponseDTO generateOTP(@Valid @RequestBody OtpRequestDTO otpRequestDt otpResponseDTO.getResponseTime()); boolean status = otpResponseDTO.getErrors() == null || otpResponseDTO.getErrors().isEmpty(); - auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.OTP_TRIGGER_REQUEST_RESPONSE, idvidHash, + auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.OTP_TRIGGER_REQUEST_RESPONSE, otpRequestDto.getTransactionID(), IdType.getIDTypeOrDefault(otpRequestDto.getIndividualIdType()), "otpRequest status : " + status); return otpResponseDTO; } catch (IDDataValidationException e) { logger.error(IdAuthCommonConstants.SESSION_ID, this.getClass().getSimpleName(), GENERATE_OTP, e.getErrorText()); - auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.OTP_TRIGGER_REQUEST_RESPONSE , idvidHash, + auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.OTP_TRIGGER_REQUEST_RESPONSE , otpRequestDto.getTransactionID(), IdType.getIDTypeOrDefault(otpRequestDto.getIndividualIdType()), e); IdaRequestResponsConsumerUtil.setIdVersionToObjectWithMetadata(requestWithMetadata, e); e.putMetadata(IdAuthCommonConstants.TRANSACTION_ID, otpRequestDto.getTransactionID()); throw authTransactionHelper.createDataValidationException(authTxnBuilder, e, requestWithMetadata); } catch (IdAuthenticationBusinessException e) { logger.error(IdAuthCommonConstants.SESSION_ID, e.getClass().toString(), e.getErrorCode(), e.getErrorText()); - auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.OTP_TRIGGER_REQUEST_RESPONSE , idvidHash, + auditHelper.audit(AuditModules.OTP_REQUEST, AuditEvents.OTP_TRIGGER_REQUEST_RESPONSE , otpRequestDto.getTransactionID(), IdType.getIDTypeOrDefault(otpRequestDto.getIndividualIdType()), e); authTransactionHelper.setAuthTransactionEntityMetadata(requestWithMetadata, authTxnBuilder); IdaRequestResponsConsumerUtil.setIdVersionToObjectWithMetadata(requestWithMetadata, e); diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/IdentityKeyBindingFacadeImpl.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/IdentityKeyBindingFacadeImpl.java index 8b50c452e74..37b60e3cb82 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/IdentityKeyBindingFacadeImpl.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/IdentityKeyBindingFacadeImpl.java @@ -146,14 +146,14 @@ public IdentityKeyBindingResponseDto processIdentityKeyBinding(@NotNull Identity status = keyBindingResponseEntry.getValue(); saveToTxnTable(identityKeyBindingRequestDTO, status, partnerId, token, authResponseDTO, keyBindingResponseDto, metadata); auditHelper.audit(AuditModules.IDENTITY_KEY_BINDING, AuditEvents.KEY_BINDIN_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(identityKeyBindingRequestDTO.getIndividualIdType()), + identityKeyBindingRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(identityKeyBindingRequestDTO.getIndividualIdType()), "Identity Key Binding status : " + status); return keyBindingResponseDto; } catch (IdAuthenticationBusinessException e) { status = false; saveToTxnTable(identityKeyBindingRequestDTO, status, partnerId, token, authResponseDTO, keyBindingResponseDto, metadata); auditHelper.audit(AuditModules.IDENTITY_KEY_BINDING, AuditEvents.KEY_BINDIN_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(identityKeyBindingRequestDTO.getIndividualIdType()), e); + identityKeyBindingRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(identityKeyBindingRequestDTO.getIndividualIdType()), e); throw e; } } 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 4f3a6f4d508..c36b61ddd4c 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 @@ -194,14 +194,14 @@ public EKycAuthResponseDTO processEKycAuth(@Nonnull EkycAuthRequestDTO kycAuthRe status = kycAuthResponse.getValue(); saveToTxnTable(kycAuthRequestDTO, status, partnerId, token, authResponseDTO, kycAuthResponseDTO, metadata, false); auditHelper.audit(AuditModules.EKYC_AUTH, AuditEvents.EKYC_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), - "kycAuthentication status : " + status); + kycAuthRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), + "kycAuthentication status : " + status); return kycAuthResponseDTO; } catch (IdAuthenticationBusinessException e) { status = false; saveToTxnTable(kycAuthRequestDTO, status, partnerId, token, authResponseDTO, kycAuthResponseDTO, metadata, false); auditHelper.audit(AuditModules.EKYC_AUTH, AuditEvents.EKYC_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), e); + kycAuthRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), e); throw e; } } @@ -327,14 +327,14 @@ public KycAuthResponseDTO processKycAuth(@Nonnull AuthRequestDTO kycAuthRequestD status = kycAuthResponse.getValue(); saveToTxnTable(kycAuthRequestDTO, status, partnerId, token, authResponseDTO, kycAuthResponseDTO, metadata, true); auditHelper.audit(AuditModules.KYC_AUTH, AuditEvents.KYC_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), + kycAuthRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), "kycAuthentication status : " + status); return kycAuthResponseDTO; } catch (IdAuthenticationBusinessException e) { status = false; saveToTxnTable(kycAuthRequestDTO, status, partnerId, token, authResponseDTO, kycAuthResponseDTO, metadata, true); auditHelper.audit(AuditModules.KYC_AUTH, AuditEvents.KYC_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), e); + kycAuthRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(kycAuthRequestDTO.getIndividualIdType()), e); throw e; } } @@ -449,12 +449,12 @@ public KycExchangeResponseDTO processKycExchange(KycExchangeRequestDTO kycExchan kycExchangeResponseDTO.setResponse(encryptedKycRespDTO); saveToTxnTable(kycExchangeRequestDTO, false, true, partnerId, token, kycExchangeResponseDTO, requestWithMetadata); auditHelper.audit(AuditModules.KYC_EXCHANGE, AuditEvents.KYC_EXCHANGE_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(kycExchangeRequestDTO.getIndividualIdType()), + kycExchangeRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(kycExchangeRequestDTO.getIndividualIdType()), IdAuthCommonConstants.KYC_EXCHANGE_SUCCESS); return kycExchangeResponseDTO; } catch(IdAuthenticationBusinessException e) { auditHelper.audit(AuditModules.KYC_EXCHANGE, AuditEvents.KYC_EXCHANGE_REQUEST_RESPONSE, - idHash, IdType.getIDTypeOrDefault(kycExchangeRequestDTO.getIndividualIdType()), e); + kycExchangeRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(kycExchangeRequestDTO.getIndividualIdType()), e); throw e; } } diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/VciFacadeImpl.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/VciFacadeImpl.java index f677f60044c..898bf51b924 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/VciFacadeImpl.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/facade/VciFacadeImpl.java @@ -186,12 +186,12 @@ public VciExchangeResponseDTO processVciExchange(VciExchangeRequestDTO vciExchan vciExchangeResponseDTO.setResponse(vcResponseDTO); saveToTxnTable(vciExchangeRequestDTO, false, true, partnerId, token, vciExchangeResponseDTO, requestWithMetadata); auditHelper.audit(AuditModules.VCI_EXCHANGE, AuditEvents.VCI_EXCHANGE_REQUEST_RESPONSE, - idvidHash, IdType.getIDTypeOrDefault(vciExchangeRequestDTO.getIndividualIdType()), + vciExchangeRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(vciExchangeRequestDTO.getIndividualIdType()), IdAuthCommonConstants.VCI_EXCHANGE_SUCCESS); return vciExchangeResponseDTO; } catch(IdAuthenticationBusinessException e) { auditHelper.audit(AuditModules.VCI_EXCHANGE, AuditEvents.VCI_EXCHANGE_REQUEST_RESPONSE, - idvidHash, IdType.getIDTypeOrDefault(vciExchangeRequestDTO.getIndividualIdType()), e); + vciExchangeRequestDTO.getTransactionID(), IdType.getIDTypeOrDefault(vciExchangeRequestDTO.getIndividualIdType()), e); throw e; } }