From bd12a04c28a19eb9525fa3c934b76e6583935cdc Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 1 Oct 2024 10:19:35 +0530 Subject: [PATCH 1/4] MOSIP-35176 Added debug log Signed-off-by: kameshsr --- .../kernel/websub/api/client/SubscriberClientImpl.java | 1 + .../mosip/kernel/websub/api/config/WebSubClientConfig.java | 1 + .../kernel/websub/api/filter/IntentVerificationFilter.java | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java index 2240894ef86..9eb9547139f 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java @@ -66,6 +66,7 @@ public class SubscriberClientImpl public SubscriptionChangeResponse subscribe(SubscriptionChangeRequest subscriptionRequest) { // TODO code duplicacy remove // TODO retries on redirect + System.out.println("i am subscribe method"); verifySubscribeModel(subscriptionRequest); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java index 21fa04ba32f..7caaac0e571 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java @@ -51,6 +51,7 @@ public FilterRegistrationBean registerIntentVerificationFilterFilterBean @Bean public IntentVerificationFilter registerIntentVerificationFilter(IntentVerifier intentVerifier) { + System.out.println("inside intentVerification filter"); return new IntentVerificationFilter(intentVerifier); } diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java index 30d6e704c21..6e161b8a0eb 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java @@ -47,8 +47,8 @@ public IntentVerificationFilter(IntentVerifier intentVerifier) { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { - logger.debug("inside doFilterInternal"); - logger.debug("HttpServletRequest request- "+request); + logger.info("inside doFilterInternal"); + logger.info("HttpServletRequest request- "+request); String topic=matchCallbackURL(request.getRequestURI()); if (request.getMethod().equals(HttpMethod.GET.name()) && topic!=null) { String topicReq = request.getParameter(WebSubClientConstants.HUB_TOPIC); @@ -93,6 +93,8 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse } private String matchCallbackURL(String requestURI) { + logger.info("mappings"+ mappings); + logger.info("requestURI-"+requestURI); if(mappings.containsKey(requestURI)) { return mappings.get(requestURI); }else { From c4f9fc5aacc787eb8169c4f2f57a8012952c552f Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 1 Oct 2024 10:28:20 +0530 Subject: [PATCH 2/4] MOSIP-35176 Added debug log Signed-off-by: kameshsr --- .../api/config/IntentVerificationConfig.java | 16 ++++++++-------- .../api/filter/IntentVerificationFilter.java | 6 ++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java index e219ef92c31..06121963b95 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java @@ -42,7 +42,7 @@ public void setEmbeddedValueResolver(StringValueResolver resolver) { @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - logger.info("inside setApplicationContext"); + System.out.println("inside setApplicationContext"); mappings = new HashMap<>(); for (String beanName : applicationContext.getBeanDefinitionNames()) { //Skip processing this intentVerificationConfig bean. @@ -52,25 +52,25 @@ public void setApplicationContext(ApplicationContext applicationContext) throws if (!((ConfigurableApplicationContext) applicationContext).getBeanFactory().getBeanDefinition(beanName) .isLazyInit()) { Object obj = applicationContext.getBean(beanName); - logger.info("bean-"+ beanName); + System.out.println("bean-"+ beanName); Class objClazz = obj.getClass(); - logger.info("objClazz"+ objClazz); + System.out.println("objClazz"+ objClazz); if (AopUtils.isAopProxy(obj)) { objClazz = AopUtils.getTargetClass(obj); } for (Method method : objClazz.getDeclaredMethods()) { - logger.info("method name-"+method); + System.out.println("method name-"+method); if (method.isAnnotationPresent(PreAuthenticateContentAndVerifyIntent.class)) { PreAuthenticateContentAndVerifyIntent preAuthenticateContent = method .getAnnotation(PreAuthenticateContentAndVerifyIntent.class); String topic = preAuthenticateContent.topic(); - logger.info("topic- "+topic); + System.out.println("topic- "+topic); String callback = preAuthenticateContent.callback(); - logger.info("callback- "+callback); + System.out.println("callback- "+callback); if (topic.startsWith("${") && topic.endsWith("}")) { topic = resolver.resolveStringValue(topic); } @@ -79,13 +79,13 @@ public void setApplicationContext(ApplicationContext applicationContext) throws callback = resolver.resolveStringValue(callback); } mappings.put(callback, topic); - logger.info("mapping"+ mappings); + System.out.println("mapping"+ mappings); } } IntentVerificationFilter intentVerificationFilter = applicationContext .getBean(IntentVerificationFilter.class); intentVerificationFilter.setMappings(mappings); - logger.info("mapping after setting value-"+mappings); + System.out.println("mapping after setting value-"+mappings); } } } diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java index 6e161b8a0eb..fc08a1c6ad8 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java @@ -41,14 +41,16 @@ public class IntentVerificationFilter extends OncePerRequestFilter { private Map mappings = null; public IntentVerificationFilter(IntentVerifier intentVerifier) { + System.out.println("inside intentVerification filter intentverifie"); + System.out.println("intentVerifier"+ intentVerifier); this.intentVerifier = intentVerifier; } @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { - logger.info("inside doFilterInternal"); - logger.info("HttpServletRequest request- "+request); + System.out.println("inside doFilterInternal"); + System.out.println("HttpServletRequest request- "+request); String topic=matchCallbackURL(request.getRequestURI()); if (request.getMethod().equals(HttpMethod.GET.name()) && topic!=null) { String topicReq = request.getParameter(WebSubClientConstants.HUB_TOPIC); From eaed66db9db8215de1c46ea1dd13e06c1b39c3ea Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 1 Oct 2024 10:39:51 +0530 Subject: [PATCH 3/4] MOSIP-35176 Added debug log Signed-off-by: kameshsr --- .../api/config/IntentVerificationConfig.java | 16 ++++++++-------- .../websub/api/config/WebSubClientConfig.java | 6 +++++- .../api/filter/IntentVerificationFilter.java | 8 ++++---- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java index 06121963b95..e219ef92c31 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/IntentVerificationConfig.java @@ -42,7 +42,7 @@ public void setEmbeddedValueResolver(StringValueResolver resolver) { @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - System.out.println("inside setApplicationContext"); + logger.info("inside setApplicationContext"); mappings = new HashMap<>(); for (String beanName : applicationContext.getBeanDefinitionNames()) { //Skip processing this intentVerificationConfig bean. @@ -52,25 +52,25 @@ public void setApplicationContext(ApplicationContext applicationContext) throws if (!((ConfigurableApplicationContext) applicationContext).getBeanFactory().getBeanDefinition(beanName) .isLazyInit()) { Object obj = applicationContext.getBean(beanName); - System.out.println("bean-"+ beanName); + logger.info("bean-"+ beanName); Class objClazz = obj.getClass(); - System.out.println("objClazz"+ objClazz); + logger.info("objClazz"+ objClazz); if (AopUtils.isAopProxy(obj)) { objClazz = AopUtils.getTargetClass(obj); } for (Method method : objClazz.getDeclaredMethods()) { - System.out.println("method name-"+method); + logger.info("method name-"+method); if (method.isAnnotationPresent(PreAuthenticateContentAndVerifyIntent.class)) { PreAuthenticateContentAndVerifyIntent preAuthenticateContent = method .getAnnotation(PreAuthenticateContentAndVerifyIntent.class); String topic = preAuthenticateContent.topic(); - System.out.println("topic- "+topic); + logger.info("topic- "+topic); String callback = preAuthenticateContent.callback(); - System.out.println("callback- "+callback); + logger.info("callback- "+callback); if (topic.startsWith("${") && topic.endsWith("}")) { topic = resolver.resolveStringValue(topic); } @@ -79,13 +79,13 @@ public void setApplicationContext(ApplicationContext applicationContext) throws callback = resolver.resolveStringValue(callback); } mappings.put(callback, topic); - System.out.println("mapping"+ mappings); + logger.info("mapping"+ mappings); } } IntentVerificationFilter intentVerificationFilter = applicationContext .getBean(IntentVerificationFilter.class); intentVerificationFilter.setMappings(mappings); - System.out.println("mapping after setting value-"+mappings); + logger.info("mapping after setting value-"+mappings); } } } diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java index 7caaac0e571..e0291e7303c 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/config/WebSubClientConfig.java @@ -2,6 +2,8 @@ import jakarta.servlet.Filter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; @@ -32,6 +34,8 @@ @EnableAspectJAutoProxy public class WebSubClientConfig { + private static final Logger logger = LoggerFactory.getLogger(WebSubClientConfig.class); + @Bean public IntentVerifier intentVerifier() { return new IntentVerifier(); @@ -51,7 +55,7 @@ public FilterRegistrationBean registerIntentVerificationFilterFilterBean @Bean public IntentVerificationFilter registerIntentVerificationFilter(IntentVerifier intentVerifier) { - System.out.println("inside intentVerification filter"); + logger.info("inside intentVerification filter"); return new IntentVerificationFilter(intentVerifier); } diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java index fc08a1c6ad8..b60647317be 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/filter/IntentVerificationFilter.java @@ -41,16 +41,16 @@ public class IntentVerificationFilter extends OncePerRequestFilter { private Map mappings = null; public IntentVerificationFilter(IntentVerifier intentVerifier) { - System.out.println("inside intentVerification filter intentverifie"); - System.out.println("intentVerifier"+ intentVerifier); + logger.info("inside intentVerification filter intentverifier"); + logger.info("intentVerifier"+ intentVerifier); this.intentVerifier = intentVerifier; } @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { - System.out.println("inside doFilterInternal"); - System.out.println("HttpServletRequest request- "+request); + logger.info("inside doFilterInternal"); + logger.info("HttpServletRequest request- "+request); String topic=matchCallbackURL(request.getRequestURI()); if (request.getMethod().equals(HttpMethod.GET.name()) && topic!=null) { String topicReq = request.getParameter(WebSubClientConstants.HUB_TOPIC); From 6c0da8823234557df3d677d76d2c941e80d91639 Mon Sep 17 00:00:00 2001 From: kameshsr Date: Tue, 1 Oct 2024 10:41:02 +0530 Subject: [PATCH 4/4] MOSIP-35176 Added debug log Signed-off-by: kameshsr --- .../io/mosip/kernel/websub/api/client/SubscriberClientImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java index 9eb9547139f..c171b35605f 100644 --- a/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java +++ b/kernel/kernel-websubclient-api/src/main/java/io/mosip/kernel/websub/api/client/SubscriberClientImpl.java @@ -66,7 +66,7 @@ public class SubscriberClientImpl public SubscriptionChangeResponse subscribe(SubscriptionChangeRequest subscriptionRequest) { // TODO code duplicacy remove // TODO retries on redirect - System.out.println("i am subscribe method"); + LOGGER.info("i am subscribe method"); verifySubscribeModel(subscriptionRequest); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);