在基於Spring Security的3.2應用程序,我有一個明確的配置UsernamePasswordAuthenticationFilter
,需要(爲了調用.onAuthentication
)到sessionAuthenticationStrategy
的參考。*如何在不明確配置策略的情況下獲取對SessionAuthenticationStrategy的引用?
的sessionAuthenticationStrategy
是<security:http>
(HttpSecurityBeanDefinitionParser
)創建的默認之一。
我的問題:如何在不配置完整的SessionAuthenticationStrategy
顯示的情況下獲得對SessionAuthenticationStrategy
的引用,以便我可以在XML配置中注入此引用?
<security:http auto-config="false" use-expressions="true"
entry-point-ref="loginUrlAuthenticationEntryPoint"
access-decision-manager-ref="httpAccessDecisionManager">
...
<security:custom-filter
ref="usernamePasswordAuthenticationFilter"
position="FORM_LOGIN_FILTER"/>
...
</security:http>
...
<bean id="usernamePasswordAuthenticationFilter"
class=" o.s.scurity.web.authentication.UsernamePasswordAuthenticationFilter">
<property name="sessionAuthenticationStrategy" ref="????"> <!-- ?? ->
...
</bean>
*我真正UsernamePasswordAuthenticationFilter
是一個定製的子類,但是這不應該的問題對於這個問題
我打開引用這個問題的問題。 https://github.com/spring-projects/spring-security/issues/3995 – mhnagaoka 2016-07-26 17:50:15