Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 在自定义RememberAuthenticationFilter之前调用应用程序控制器_Spring_Security_Authentication_Filter - Fatal编程技术网

Spring 在自定义RememberAuthenticationFilter之前调用应用程序控制器

Spring 在自定义RememberAuthenticationFilter之前调用应用程序控制器,spring,security,authentication,filter,Spring,Security,Authentication,Filter,我们正在尝试在应用程序中实现Spring安全性。我们正在扩展RemembermAuthenticationFilter。但问题是,我们的应用程序控制器在RememberMeAuthenticationFilter之前被调用是否仍有强制在应用程序控制器之前调用MemberMemberAuthenticationFilter的方法? 下面是我的配置。在调试模式下,我可以看到FilterChainProxy.VirtualFilterChain有两组过滤器-原始过滤器和附加过滤器。原始筛选器具有spr

我们正在尝试在应用程序中实现Spring安全性。我们正在扩展RemembermAuthenticationFilter。但问题是,我们的应用程序控制器在RememberMeAuthenticationFilter之前被调用是否仍有强制在应用程序控制器之前调用MemberMemberAuthenticationFilter的方法? 下面是我的配置。在调试模式下,我可以看到FilterChainProxy.VirtualFilterChain有两组过滤器-原始过滤器和附加过滤器。原始筛选器具有springSecurityFilterChain,但它不调用自定义MemberMetauthenticationFilter。其他过滤器具有RememberMeAuthenticationFilter。控制器在原始筛选器末尾通过DispatcherServlet调用

Web.xml

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

<filter-mapping>
  <filter-name>springSecurityFilterChain</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
spring-security-context.xml

<http use-expressions="true" auto-config="false" entry-point-ref="authenticationProcessingFilterEntryPoint" create-session="ifRequired" >
<long list of intercept-url here>
    <intercept-url pattern="/**" access="permitAll" requires-channel="any"/>



    <custom-filter ref="rememberMeProcessingFilter" position="REMEMBER_ME_FILTER" />
        <custom-filter ref="authenticationProcessingFilter" position="FORM_LOGIN_FILTER" />


 </http>



<beans:bean id="rememberMeProcessingFilter" class="uk.co.and.dealofday.security.SecurityRememberMeAuthenticationFilter">
    <beans:property name="authenticationManager" ref="authenticationManager" />
    <beans:property name="rememberMeServices" ref="rememberMeServices" />
</beans:bean> 



<beans:bean id="authenticationProcessingFilter" class="uk.co.and.dealofday.security.SecurityUsernamePasswordAuthenticationFilter">
    <beans:property name="authenticationManager" ref="authenticationManager" />
    <beans:property name="rememberMeServices" ref="rememberMeServices" />
    <beans:property name="userService" ref="userService"/>
    <beans:property name="securityHelper" ref="securityHelper" />
</beans:bean> 

声明自定义
记住
自定义
身份验证后的筛选
筛选

<custom-filter ref="authenticationProcessingFilter" position="FORM_LOGIN_FILTER" />
<custom-filter ref="rememberMeProcessingFilter" position="REMEMBER_ME_FILTER" />


应该调用它,因为?没有安全的URL(没有
元素),因此永远不会执行筛选器。有一长串截取URL。我只是跳过了那部分。你一开始没有提到:)。过滤器应始终在servlet(以及控制器)之前执行。如果没有,您的配置在某个地方有问题。