package com.quakearts.webapp.security.rest.filter;

import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

public class ResourceAuthenticationFilter extends AuthenticationFilter {
	private String[] resourcePatterns;
	
	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		super.init(filterConfig);
		String resourcePatternsString = filterConfig.getInitParameter("resourcePatterns");
		if(resourcePatternsString == null)
			throw new ServletException("Filter parameter 'resourcePatterns' required");	
		
		resourcePatterns = resourcePatternsString.split(",");
	}
	
	@Override
	protected boolean proceedWithAuthentication(HttpServletRequest request) {
		for(String resourcePattern : resourcePatterns){
			if(request.getPathInfo()!=null 
					&& request.getPathInfo().matches(resourcePattern))
				return true;
		}
		
		return false;
	}
}

@@ -665,16 +665,166 @@
 (%22,%22);%0D%0A
+%09%09%0D%0A%09%09for (int index = 0; index %3C resourcePatterns.length; index++) %7B%0D%0A%09%09%09resourcePatterns%5Bindex%5D = resourcePatterns%5Bindex%5D.replace(%22*%22, %22.*%22);%0D%0A%09%09%7D%0D%0A
 %09%7D%0D%0A%09%0D%0A%09

Check in