spring-security Hybris中的超驰Spring过滤器

hyrbngr7  于 2022-11-11  发布在  Spring
关注(0)|答案(1)|浏览(196)

我想覆盖OOTB过滤器“RememberMeAuthenticationFilter”的doFilter方法,以便在try块中添加更多的条件。我尝试在spring-security-config.xml中使用以下内容:

<security:custom-filter position="REMEMBER_ME_FILTER" ref="myRememberMeFilter"/>

<bean id="myRememberMeFilter"
        class="com.dfg.storefront.security.rememberme.MyRememberMeAuthenticationFilter">
        <property name="rememberMeServices" ref="myRememberMeServices" />
        <property name="authenticationManager" ref="authenticationManager" />
        <property name="authenticationSuccessHandler" ref="loginGuidAuthenticationSuccessHandler" />
    </bean>

但是当我打开网站时,我得到404错误。有人能建议如何在hybris应用程序中覆盖“RememberMeAuthenticationFilter”吗?

jm2pwxwz

jm2pwxwz1#

您可以使用别名覆盖OOTB bean,而不是使用<security:custom-filter...../>

<alias name="myRememberMeFilter" alias="rememberMeProcessingFilter"/>
<bean id="myRememberMeFilter"
    class="com.dfg.storefront.security.rememberme.DfgRememberMeAuthenticationFilter">
    <property name="rememberMeServices" ref="myRememberMeServices" />
    <property name="authenticationManager" ref="authenticationManager" />
    <property name="authenticationSuccessHandler" ref="loginGuidAuthenticationSuccessHandler" />
</bean>

相关问题