Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Security configuration causing redirect loop
    primarykey
    data
    text
    <p>I have recently started learning spring security and trying to incorporate it into my existing web application. The app is simple in configuration so I'm confused where I've managed to screw it up.</p> <p>My web.xml</p> <pre><code>&lt;!-- FilterChain proxy for security --&gt; &lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/appname-servlet.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;servlet&gt; &lt;servlet-name&gt;nistreq&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/appname-servlet.xml&lt;/param-value&gt; &lt;/init-param&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;appname&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;mainpage.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; </code></pre> <p>and the security-config.xml</p> <pre><code>&lt;security:http access-denied-page="/denied.jsp" use-expressions="true"&gt; &lt;security:form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?login_error=true" /&gt; &lt;security:intercept-url pattern="/*" access="isAuthenticated()"/&gt; &lt;security:logout/&gt; &lt;/security:http&gt; </code></pre> <p>There looks to be some bad mojo between my URIs I've mapped for the springSecurityFilterChain ("/<em>"), the servlet mapping's URL pattern ("/"), and the security:intercept-url pattern ("/</em>"). This causes a redirect loop. I've gone through countless variations of moving terms around, pushing content into sub-packages to avoid protecting the application root, etc. I always end up with a grab bag of a 404, a redirect loop, etc. </p> <p>I'm doing something really boneheaded here and would appreciate another set of eyes. Thanks for any insights...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload