How can I bypass Waffle in new namespace of existing web app?

Oct 27, 2011 at 11:28 AM

I have a new namespace in my WebContent folder called /nau and I need to be able to redirect a user that is an authenticated domain user but does not have permissions to access the application to a specific web page(s) within this new namespace in the same web app without having to go thru Waffle.  Any help/direction would be appreciated.  

Regards.

I tried using the following code to redirect user but got stuck in loop where Waffle kept trying to authenticate user:

public UnauthorizedException(final HttpServletResponse response, final String userName) throws IOException {
     //response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "User: " + userName.toUpperCase() + " is not authorized to access this resource");

     response.sendRedirect("/nau/unAuthorizedUser.jsp");
}

My web.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<web-app	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			xmlns="http://java.sun.com/xml/ns/javaee"
			xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
			xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
			id="WebApp_ID"
			version="2.5">

  <display-name>SCMIS</display-name>

<!-- 1. Setup filters					-->
<!--	a) SCMIS Security Filter		-->
<!--	b) Stripes Filter				-->


   	<filter>
   		<filter-name>Waffle SecurityFilter</filter-name>
   		<filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class>
   	</filter>

	<filter>
		<display-name>SCMIS Security Filter</display-name>
		<filter-name>SCMISSecurityFilter</filter-name>
		<filter-class>org.texashealth.scmis.security.Filter</filter-class>
	</filter>

	<filter>
		<display-name>Stripes Filter</display-name>
		<filter-name>StripesFilter</filter-name>
		<filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
		<init-param>
			<param-name>ActionResolver.Packages</param-name>
			<param-value>org.texashealth.scm.stripes,org.texashealth.scmis.stripes</param-value>
		</init-param>
		<init-param>
			<param-name>Extension.Packages</param-name>
			<param-value>org.texashealth.scmis.stripes.ext</param-value>
		</init-param>
		<init-param>
      		<param-name>PopulationStrategy.Class</param-name>
      		<param-value>net.sourceforge.stripes.tag.BeanFirstPopulationStrategy</param-value>
    	</init-param>
	</filter>
   
    <filter-mapping>
	   	<filter-name>Waffle SecurityFilter</filter-name>
	   	<url-pattern>*.jsp</url-pattern>
	   	<dispatcher>REQUEST</dispatcher>
   	</filter-mapping>
   	
   	<filter-mapping>
   		<filter-name>Waffle SecurityFilter</filter-name>
   		<url-pattern>*.action</url-pattern>
   		<dispatcher>REQUEST</dispatcher>
   	</filter-mapping>

	<filter-mapping>
		<filter-name>SCMISSecurityFilter</filter-name>
		<url-pattern>*.jsp</url-pattern>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<filter-mapping>
		<filter-name>SCMISSecurityFilter</filter-name>
		<url-pattern>*.action</url-pattern>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<filter-mapping>
		<filter-name>StripesFilter</filter-name>
		<url-pattern>*.jsp</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
	</filter-mapping>

	<filter-mapping>
		<filter-name>StripesFilter</filter-name>
		<servlet-name>StripesDispatcher</servlet-name>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

 2. Setup servlets					 					
<!--	a) Stripes Dispatcher			-->

	<servlet>
		<display-name>Stripes Dispatcher</display-name>
		<servlet-name>StripesDispatcher</servlet-name>
		<servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>StripesDispatcher</servlet-name>
		<url-pattern>*.action</url-pattern>
	</servlet-mapping>

<!-- 3. Setup error page/welcome files   -->	
 
	<error-page>
		<exception-type>java.lang.Exception</exception-type>
		<location>/error.jsp</location>
	</error-page>

	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>

Coordinator
Oct 28, 2011 at 3:47 AM

A filter is by definition a catch-all. So you'll have to modify waffle to exclude a certain location or somehow exclude it in url-pattern in filter-mapping.