当过滤器设置为'none'时,Grails 3使用Spring-Security-Core 3.0.3插件servlet过滤器使用filterChain进行排序

Ste*_*man 6 grails spring-security grails-3.0

我的任务是将一些传统的Grails 2.x应用程序升级到Grails 3.0.14.由于应用程序使用了Spring-Security-Core插件,我将其升级到3.0.3.但是,我经常偶然发现导致此错误的无法访问的静态资产:

java.lang.IllegalStateException: There was a problem retrieving the current GrailsWebRequest. This usually indicates a filter ordering issue (the 'springSecurityFilterChain' filter-mapping element must be positioned after the 'grailsWebRequest' element when using @Secured annotations).
Run Code Online (Sandbox Code Playgroud)

我没有任何已定义的FilterRegistrationBean,我没有使用SpringSecurityUtils.clientRegisterFilter,也没有web.xml,所以我不确定应用程序如何改变默认的servlet过滤器顺序来导致此问题.

唯一的区别似乎在我的application.groovy:

grails.plugin.springsecurity.filterChain.chainMap = [
    [pattern: '/assets/**',      filters: 'none'],
    [pattern: '/**',             filters: 'JOINED_FILTERS']
]
Run Code Online (Sandbox Code Playgroud)

如果我删除过滤器:'none'行,一切正常.我知道在Java应用程序中,Spring Security 3.1.x不推荐使用filters ="none",而在更现代的版本中,它完全不受支持.这是什么导致这个奇怪的错误信息?