0
所以我想在Spring Social Showcase-Sec-XML示例中添加一個記住我的功能。所以我想讓它成爲一個基於持久性的記憶我,但是每當我將數據源添加到記憶我時,我都會遇到一個錯誤。基於持久性的Remember-Me在Spring社交樣本中正常登錄
這是我在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
有沒有辦法讓它使用持久基於記得我當它是一個常規登錄?