How can I use a custom configured RememberMeAuthenticationFilter in spring security?

Posted by Sebastian on Stack Overflow See other posts from Stack Overflow or by Sebastian
Published on 2012-11-17T16:57:43Z Indexed on 2012/11/17 16:59 UTC
Read the original article Hit count: 237

Filed under:

I want to use a slightly customized rememberme functionality with spring security (3.1.0).

I declare the rememberme tag like this:

<security:remember-me key="JNJRMBM" user-service-ref="gymUserDetailService" />

As I have my own rememberme service I need to inject that into the RememberMeAuthenticationFilter which I define like this:

<bean id="rememberMeFilter" class="org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter">
    <property name="rememberMeServices" ref="gymRememberMeService"/>
    <property name="authenticationManager" ref="authenticationManager" />
</bean>

I have spring security integrated in a standard way in my web.xml:

<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

Everything works fine, except that the RememberMeAuthenticationFilter uses the standard RememberMeService, so I think that my defined RememberMeAuthenticationFilter is not being used.

How can I make sure that my definition of the filter is being used? Do I need to create a custom filterchain? And if so, how can I see my current "implicit" filterchain and make sure I use the same one except my RememberMeAuthenticationFilter instead of the default one?

Thanks for any advice and/or pointers!

© Stack Overflow or respective owner

Related posts about spring-security