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 Revert debugging changes #1580

Merged
merged 1 commit into from
Oct 1, 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 @@ -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
Loading