1
我最近开始学习spring安全并试图将它合并到我现有的web应用程序中。该应用程序配置简单,所以我很困惑我在哪里搞砸了。Spring安全配置导致重定向循环
我的web.xml
<!-- FilterChain proxy for security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/appname-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>nistreq</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/appname-servlet.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>appname</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>mainpage.jsp</welcome-file>
</welcome-file-list>
和安全-config.xml中
<security:http access-denied-page="/denied.jsp" use-expressions="true">
<security:form-login login-page="/login.jsp"
authentication-failure-url="/login.jsp?login_error=true" />
<security:intercept-url pattern="/*" access="isAuthenticated()"/>
<security:logout/>
</security:http>
有看起来是我的URI我映射为springSecurityFilterChain(“/ 之间的一些不好的魔力“),servlet映射的URL模式(”/“)和安全:拦截URL模式(”/“)。这会导致重定向循环。我经历了无数种移动词汇的变化,将内容推送到子包中以避免保护应用程序根等。我总是以404的一个抓包,重定向循环等为终端。
I我正在做一些真正在这里头脑发热的东西,并会欣赏另一双眼睛。感谢您的任何见解...
你发现了它。我实际上是这么做的: –
Raevik
2012-07-06 21:01:13
我实际上仍然遇到问题,我的登录页面重定向不能解决(获取404),但你确实确定了问题的第一部分。谢谢。 – Raevik 2012-07-06 21:02:15