From 4868d3ed2445c2d2a3d0df8523497457c43a27e2 Mon Sep 17 00:00:00 2001 From: Manish Choudhary Date: Wed, 10 Jan 2024 09:38:08 +0530 Subject: [PATCH] Updated callback API for websub --- .../mosip/opencrvs/controller/InternalRestController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mediator/src/main/java/io/mosip/opencrvs/controller/InternalRestController.java b/mediator/src/main/java/io/mosip/opencrvs/controller/InternalRestController.java index 5da06fb..bde03ea 100644 --- a/mediator/src/main/java/io/mosip/opencrvs/controller/InternalRestController.java +++ b/mediator/src/main/java/io/mosip/opencrvs/controller/InternalRestController.java @@ -2,6 +2,7 @@ import io.mosip.kernel.core.exception.BaseCheckedException; import io.mosip.kernel.core.logger.spi.Logger; +import io.mosip.kernel.websub.api.annotation.PreAuthenticateContentAndVerifyIntent; import io.mosip.opencrvs.constant.LoggingConstants; import io.mosip.opencrvs.dto.SimpleMessageResponse; import io.mosip.opencrvs.dto.WebsubRequest; @@ -29,7 +30,10 @@ public SimpleMessageResponse unsubscribe() { return SimpleMessageResponse.setResponseMessage("unable to unsubscribe"); } - @PostMapping(value = "/receiveCredentialBirth", consumes = MediaType.APPLICATION_JSON_VALUE) + //@PostMapping(value = "/receiveCredentialBirth", consumes = MediaType.APPLICATION_JSON_VALUE) + //@PreAuthenticateContentAndVerifyIntent(secret = "abc@123",callback = "" ,topic = "") + @PostMapping(path = "/receiveCredentialBirth", consumes = MediaType.APPLICATION_JSON_VALUE) + @PreAuthenticateContentAndVerifyIntent(secret = "${mosip.opencrvs.partner.client.sha.secret}", callback = "/opencrvs/v1/internal/receiveCredentialBirth", topic = "${mosip.opencrvs.partner.client.id}/CREDENTIAL_ISSUED") public SimpleMessageResponse postReceiveUinOnBirth(@RequestBody WebsubRequest body) { LOGGER.info(LoggingConstants.SESSION, LoggingConstants.ID, "postReceiveUinOnBirth", "Here is the request received - " + body); receiveCredentialService.tokenizeReceivedCredential(body);