Spring Security Core Plugin 四(Filters)

filterNames

通过rails.plugin.springsecurity.filterChain.filterNames来定制过滤器.

grails.plugin.springsecurity.filterChain.filterNames = [
   'securityContextPersistenceFilter', 'logoutFilter',
   'authenticationProcessingFilter', 'myCustomProcessingFilter',
   'rememberMeAuthenticationFilter', 'anonymousAuthenticationFilter',
   'exceptionTranslationFilter', 'filterInvocationInterceptor'
]

chainMap

定制不同的过滤器应用到不同的url格式上.

grails.plugin.springsecurity.filterChain.chainMap = [
   [pattern: '/urlpattern1/**', filters: 'filter1,filter2,filter3,filter4'],
   [pattern: '/urlpattern2/**', filters: 'filter1,filter3,filter5'],
   [pattern: '/**',             filters: 'JOINED_FILTERS']
]

JOINED_FILTERS用于把所以已定义的过滤器应用到此URL 格式 上.

clientRegisterFilter

另一种配置filterNames属性的方式是rails.plugin.springsecurity.SpringSecurityUtils.clientRegisterFilter()

grails-app/init/BootStrap.groovy

import grails.plugin.springsecurity.SecurityFilterPosition
import grails.plugin.springsecurity.SpringSecurityUtils

class BootStrap {

   def init = {
      SpringSecurityUtils.clientRegisterFilter(
          'myFilter', SecurityFilterPosition.OPENID_FILTER.order + 10)
   }
}

 

最后欢迎大家访问我的个人网站:1024s​​​​​​​

你可能感兴趣的:(秒扒Spring)