在我的Grails 2.5.X应用程序中,我使用的是Spring Security REST插件,并已在Config.groovy
中配置了登录URL。
grails.plugin.springsecurity.rest.login.endpointUrl = '/internal/login'
我需要对此网址应用过滤器,并尝试使用
class GrailsFilters {
def filters = {
login(uri: '/internal/login') {
before = {
// implementation omitted
}
after = { Map model ->
// implementation omitted
}
}
}
}
但是出于某种奇怪的原因,从未调用过该过滤器。登录端点是否有特殊之处,这意味着无法对其进行过滤?
最佳答案
是的,有一些特别之处。它使用的Servlet过滤器(其中的链)的优先级高于您尝试使用的Grails过滤器。
如果您需要拦截 call ,则需要在Spring Security过滤器链中创建自己的过滤器。 documentation包含用于详细说明的整个部分。
关于grails - 将Grails过滤器应用于登录URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36552327/