我們有一個基於appfuse入門套件2.2.1版的示例web應用程序,它使用Spring security 3.1.3.RELEASE。我們將在WAS 7上部署它,並且正在IBM WebSphere 8.5.5.8(Liberty)上進行測試。 我們的問題是成功/失敗登錄請求後,有些東西破壞了請求的servletPath值並將其設置爲null。IBM WebSphere 8.5.5.8(Liberty)+ Spring Security 3.1.3.RELEASE
((HttpServletRequest的)請求).getServletPath()
這是當LocaleFilter嘗試使用chain.doFilter爲getServletPath()/ j_security_check值做的時間和我們遇到:
異常由應用類拋出 'org.springframework.security.web.util.AntPathRequestMatcher.getRequestPath:116' 顯示java.lang.NullPointerException: 在org.springframework.security.web.util.AntPathRequestMatche r.getRequestPath(AntPathRequestMatcher.java:116) at org.springframework.security.web.util.AntPathRequestMatcher.matches(AntPathRequestMatcher.java:100) at org.springframework.security.web.DefaultSecurityFilterChain.matches(DefaultSecurityFilterChain.java: 42) 在org.springframework.security.web.FilterChainProxy.getFilters(FilterChainProxy.java:203) 在org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:176) 在org.springframework.security。 web.FilterChainProxy.doFilter(FilterChainProxy.java:160) 在org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) 在org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java: 259) at com.i bm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207) 在[內部類]在 com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:59) 在com.ibm。 ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207) 在[內部類]在 org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213) 在org.tuckey。 web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite。 UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter (UrlRewriteFilter.java:394) 在com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207) 在[內部類]在 ir.dpi.webapp.filter.LocaleFilter.doFilterInternal(LocaleFilter的.java:67) 在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 在com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207) 在[內部類]在 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 在org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) 在com.ibm.ws .webcontainer.filter.FilterInstanceWrapper.doFilter(FilterIns tanceWrapper.java:207) 在[內部類]在 com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129) 在com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java: 77) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper。Java的:207)在[內部類]
這是我們的security.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<http pattern="/images/**" security="none"/>
<http pattern="/styles/**" security="none"/>
<http pattern="/scripts/**" security="none"/>
<http auto-config="false" create-session="always">
<intercept-url pattern="/app/admin/**" access="ROLE_ADMIN"/>
<intercept-url pattern="/app/passwordHint*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
<intercept-url pattern="/app/signup*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
<intercept-url pattern="/app/**" access="ROLE_ADMIN,ROLE_USER"/>
<form-login login-page="/login" authentication-failure-url="/login?error=true" login-processing-url="/j_security_check"/>
<remember-me user-service-ref="userDao" key="e37f4b31-0c45-11dd-bd0b-0800200c9a66"/>
</http>
<authentication-manager >
<authentication-provider user-service-ref="userDao" >
<password-encoder ref="passwordEncoder" >
<salt-source ref="saltSource" />
</password-encoder>
</authentication-provider>
</authentication-manager>
<beans:bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"
p:userPropertyToUse="username"/>
<global-method-security>
<protect-pointcut expression="execution(* *..service.UserManager.getUsers(..))" access="ROLE_ADMIN"/>
<protect-pointcut expression="execution(* *..service.UserManager.removeUser(..))" access="ROLE_ADMIN"/>
</global-method-security>
</beans:beans>
任何幫助,將不勝感激。