Spring安全性自定义过滤器未被调用

时间:2016-08-10 14:06:16

标签: java spring rest spring-security

我想为Spring应用程序中的每个请求编写自定义过滤器以进行令牌验证。

为此,我在spring security xml中编写了以下代码,但自定义过滤器没有调用。任何人都可以建议这为什么会发生这种情况?

我没有任何登录表单,我们只有简单的REST服务。因此,不确定我必须在哪个位置提供自定义过滤器。

我正在使用自定义过滤器位置,如下所示。

<http entry-point-ref="restAuthenticationEntryPoint" create-session="always">
    <intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" />  
    <custom-filter after="BASIC_AUTH_FILTER" ref="jwtAuthenticationFilter"/>         
</http> 

<authentication-manager alias="authenticationManager">
    <authentication-provider ref="jwtAuthenticationProvider" /> 
</authentication-manager>

<bean id="restAuthenticationEntryPoint" class="com.test.RestAuthenticationEntryPoint" /> 
<bean id="jwtAuthenticationProvider" class="com.test.JwtAuthenticationProvider" />

0 个答案:

没有答案