所以我想在 Spring Social Showcase-Sec-XML 示例中添加一个记住我的功能。所以我想让它成为一个基于持久性的记住我,但是每当我将数据源添加到记住我时,我都会得到一个错误。
这是我在 security.xml 中的代码
<http use-expressions="true">
<!-- Authentication policy -->
<form-login login-page="/signin" login-processing-url="/signin/authenticate" authentication-failure-url="/signin?param.error=bad_credentials" />
<logout logout-url="/signout" delete-cookies="JSESSIONID" />
<intercept-url pattern="/favicon.ico" access="permitAll" />
<intercept-url pattern="/resources/**" access="permitAll" />
<intercept-url pattern="/auth/**" access="permitAll" />
<intercept-url pattern="/signin/**" access="permitAll" />
<intercept-url pattern="/signup/**" access="permitAll" />
<intercept-url pattern="/disconnect/facebook" access="permitAll" />
<intercept-url pattern="/**" access="isAuthenticated()" />
<remember-me key="jbcpCalendar"
data-source-ref="dataSource"/>
<!-- Spring Social Security authentication filter -->
<custom-filter ref="socialAuthenticationFilter" before="PRE_AUTH_FILTER" />
</http>
这是给出错误的 socialAuthenticationFilter bean。
<bean id="socialAuthenticationFilter" class="org.springframework.social.security.SocialAuthenticationFilter"
c:_0-ref="authenticationManager"
c:_1-ref="userIdSource"
c:_2-ref="usersConnectionRepository"
c:_3-ref="connectionFactoryLocator"
p:signupUrl="/spring-social-showcase/signup"
p:rememberMeServices-ref="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0" /> <!-- TODO: Figure out how to wire this without this name -->
这是出来的堆栈跟踪):
Cannot resolve reference to bean 'socialAuthenticationFilter' while setting
constructor argument with key [2]; nested exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'socialAuthenticationFilter'
defined in ServletContext resource [/WEB-INF/spring/social-security.xml]: Cannot
resolve reference to bean
'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0'
while setting bean property 'rememberMeServices'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named
'org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0' is defined
有没有办法让它在常规登录时使用基于持久性的记住我?