Skip to content

Commit

Permalink
MOSIP-35176 Revert debugging changes
Browse files Browse the repository at this point in the history
Signed-off-by: kameshsr <kameshsr1338@gmail.com>
  • Loading branch information
kameshsr committed Oct 1, 2024
1 parent 6b57f32 commit 62fe307
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public void setEmbeddedValueResolver(StringValueResolver resolver) {

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

objClazz = AopUtils.getTargetClass(obj);
}

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

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

String callback = preAuthenticateContent.callback();
logger.info("callback- "+callback);
if (topic.startsWith("${") && topic.endsWith("}")) {
topic = resolver.resolveStringValue(topic);
}
Expand All @@ -79,13 +73,11 @@ public void setApplicationContext(ApplicationContext applicationContext) throws
callback = resolver.resolveStringValue(callback);
}
mappings.put(callback, topic);
logger.info("mapping"+ mappings);
}
}
IntentVerificationFilter intentVerificationFilter = applicationContext
.getBean(IntentVerificationFilter.class);
intentVerificationFilter.setMappings(mappings);
logger.info("mapping after setting value-"+mappings);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,12 @@ public class IntentVerificationFilter extends OncePerRequestFilter {
private Map<String, String> mappings = null;

public IntentVerificationFilter(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 {
logger.info("inside doFilterInternal");
logger.info("HttpServletRequest request- "+request);
if(!request.getRequestURI().contains("health")) {
String topic = matchCallbackURL(request.getRequestURI());
if (request.getMethod().equals(HttpMethod.GET.name()) && topic != null) {
String topicReq = request.getParameter(WebSubClientConstants.HUB_TOPIC);
Expand Down Expand Up @@ -94,11 +89,9 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
filterChain.doFilter(request, response);
}
}
}


private String matchCallbackURL(String requestURI) {
logger.info("mappings"+ mappings);
logger.info("requestURI-"+requestURI);
if(mappings.containsKey(requestURI)) {
return mappings.get(requestURI);
}else {
Expand Down

0 comments on commit 62fe307

Please sign in to comment.