我有一个使用 JSF 创建的自定义登录页面。但是,一旦我运行应用程序,我就会收到错误消息“Firefox 检测到服务器正在以永远不会完成的方式重定向对该地址的请求。”
这是我的web.xml
:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
/WEB-INF/applicationContext-security.xml
</param-value>
</context-param>
<!-- Enable Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<!-- Allow login pages with JSF which redirects to security check,
therefore we have to add the forward entry here -->
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
和我的applicationContext-security.xml
<http auto-config='true' use-expressions="true" access-denied-page="/index.xhtml">
<intercept-url pattern="/jsf/admin_*" access="hasRole('ADMIN')"/>
<intercept-url pattern="/jsf/pm_*" access="hasRole('PM')"/>
<intercept-url pattern="/jsf/la_*" access="hasRole('ACCOUNT_APPROVER')"/>
<intercept-url pattern="/jsf/bc_*" access="hasRole('BILLING_CONTACT')"/>
<intercept-url pattern="/**" access="hasRole('USER') or hasRole('ADMIN') or hasRole('PM')"/>
<form-login login-processing-url="/j_spring_security_check" login-page="/login.xhtml" />
</http>
<authentication-manager>
<authentication-provider user-service-ref='myUserDetailsService'>
<password-encoder hash="sha"/>
</authentication-provider>
</authentication-manager>
<beans:bean id="myUserDetailsService" class="lk.mazarin.wcplus.security.WcUserDetailsServiceWrapper">
<beans:property name="wcUserDAO" ref="wcUserDAO"/>
</beans:bean>
<beans:bean id="wcPasswordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"/>