// Path: jcart-admin/src/main/java/com/sivalabs/jcart/admin/security/PostAuthorizationFilter.java
// @Component
// public class PostAuthorizationFilter extends OncePerRequestFilter
// {
// 	@Autowired SecurityService securityService;
// 	
// 	protected String[] IGNORE_URIS = {
// 			"/assets/"
// 	};
// 	
// 	@Override
// 	protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
// 			throws ServletException, IOException
// 	{
// 		String uri = request.getRequestURI();
// 		if(!isIgnorableURI(uri)){
// 			String menu = MenuConfiguration.getMatchingMenu(uri);
// 			request.setAttribute("CURRENT_MENU", menu);
// 		}
// 		chain.doFilter(request, response);
// 	}
// 	
// 	private boolean isIgnorableURI(String uri)
// 	{
// 		for (String u : IGNORE_URIS) 
// 		{
// 			if(uri.startsWith(u))
// 			{
// 				return true;
// 			}
// 		}
// 		return false;
// 	}
// }


import javax.servlet.Filter;
import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
import com.sivalabs.jcart.admin.security.PostAuthorizationFilter;
/**
 * 
 */
package com.sivalabs.jcart.admin.config;




/**
 * @author Siva
 *
 */
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter
{   
	@Value("${server.port:9443}") private int serverPort;
	
	@Autowired 
// Path: jcart-admin/src/main/java/com/sivalabs/jcart/admin/security/PostAuthorizationFilter.java
// @Component
// public class PostAuthorizationFilter extends OncePerRequestFilter
// {
// 	@Autowired SecurityService securityService;
// 	
// 	protected String[] IGNORE_URIS = {
// 			"/assets/"
// 	};
// 	
// 	@Override
// 	protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
// 			throws ServletException, IOException
// 	{
// 		String uri = request.getRequestURI();
// 		if(!isIgnorableURI(uri)){
// 			String menu = MenuConfiguration.getMatchingMenu(uri);
// 			request.setAttribute("CURRENT_MENU", menu);
// 		}
// 		chain.doFilter(request, response);
// 	}
// 	
// 	private boolean isIgnorableURI(String uri)
// 	{
// 		for (String u : IGNORE_URIS) 
// 		{
// 			if(uri.startsWith(u))
// 			{
// 				return true;
// 			}
// 		}
// 		return false;
// 	}
// }


// Path: jcart-admin/src/main/java/com/sivalabs/jcart/admin/config/WebConfig.java
import javax.servlet.Filter;
import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
import com.sivalabs.jcart.admin.security.PostAuthorizationFilter;

/**
 * 
 */
package com.sivalabs.jcart.admin.config;




/**
 * @author Siva
 *
 */
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter
{   
	@Value("${server.port:9443}") private int serverPort;
	
	@Autowired 
	private PostAuthorizationFilter postAuthorizationFilter;