Assuming I have a main.jsp which include another protected page
<%
RequestDispatcher rd = request.getRequestDispatcher("secure/protected.jsp");
rd.include(request, response);
%>
<http auto-config="true" once-per-request="true">
<intercept-url pattern="/secure/**" access="ROLE_SUPERVISOR" />
....
</http>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Currently, what I found are:
- Spring security filter is actually invoked.
- protected.jsp is still displayed in main.jsp. (but I expect protected.jsp will be blocked by spring security)
I have read related discussions: Spring Security Allows Unauthorized User Access to Restricted URL from a Forward
is it possible to secure an included jsp? If not, why? I guess reason is when we use request dispatcher, we still pass original request, so spring security filter only knows original request path (main.jsp) and don't know target included path (protectected.jsp). Therefore, it doesn't block the inclusion of protectected.jsp
but it doesn't work. I use Spring security 3.1.2.