Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-35176 Added loggers #1573

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -31,13 +33,16 @@ public class IntentVerificationConfig implements ApplicationContextAware, Embedd
private Map<String, String> mappings = null;
private StringValueResolver resolver = null;

private static final Logger logger = LoggerFactory.getLogger(IntentVerificationConfig.class);

@Override
public void setEmbeddedValueResolver(StringValueResolver resolver) {
this.resolver = resolver;
}

@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
logger.debug("inside setApplicationContext");
mappings = new HashMap<>();
for (String beanName : applicationContext.getBeanDefinitionNames()) {
//Skip processing this intentVerificationConfig bean.
Expand All @@ -47,19 +52,25 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
if (!((ConfigurableApplicationContext) applicationContext).getBeanFactory().getBeanDefinition(beanName)
.isLazyInit()) {
Object obj = applicationContext.getBean(beanName);
logger.debug("bean-"+ beanName);
Class<?> objClazz = obj.getClass();
logger.debug("objClazz"+ objClazz);
if (AopUtils.isAopProxy(obj)) {

objClazz = AopUtils.getTargetClass(obj);
}

for (Method method : objClazz.getDeclaredMethods()) {
logger.debug("method name-"+method);
if (method.isAnnotationPresent(PreAuthenticateContentAndVerifyIntent.class)) {
PreAuthenticateContentAndVerifyIntent preAuthenticateContent = method
.getAnnotation(PreAuthenticateContentAndVerifyIntent.class);

String topic = preAuthenticateContent.topic();
logger.debug("topic- "+topic);

String callback = preAuthenticateContent.callback();
logger.debug("callback- "+callback);
if (topic.startsWith("${") && topic.endsWith("}")) {
topic = resolver.resolveStringValue(topic);
}
Expand All @@ -68,6 +79,7 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
callback = resolver.resolveStringValue(callback);
}
mappings.put(callback, topic);
logger.debug("mapping"+ mappings);
}
}
IntentVerificationFilter intentVerificationFilter = applicationContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public IntentVerificationFilter(IntentVerifier intentVerifier) {

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
throws ServletException, IOException {
logger.debug("inside doFilterInternal");
logger.debug("HttpServletRequest request- "+request);
String topic=matchCallbackURL(request.getRequestURI());
if (request.getMethod().equals(HttpMethod.GET.name()) && topic!=null) {
String topicReq = request.getParameter(WebSubClientConstants.HUB_TOPIC);
Expand Down
Loading