如何使用带有Grails Spring Security插件的InterceptMap公开公开 Controller 的方法?
我有这样的网址:
http://localhost:8080/testapp/user/showIdentity?token=2&userID=b18cac92f0636da8fcd464d5b595b9aba86b5f11
所以在我的interceptMap中,我有:
grails.plugin.springsecurity.interceptUrlMap = [
'/': ['permitAll'],
'/index': ['permitAll'],
'/index.gsp': ['permitAll'],
'/**/js/**': ['permitAll'],
'/**/css/**': ['permitAll'],
'/**/images/**': ['permitAll'],
'/**/favicon.ico': ['permitAll'],
'/login/**': ['permitAll'],
'/logout/**': ['permitAll'],
'/**': ['ROLE_ADMIN']
]
如何将 Controller 的“showIdentity”方法允许为allowAll,而将其余 Controller 方法允许为ROLE_ADMIN,这是 Controller 的默认设置?
我知道使用Spring Security ACL插件我们可以做更多的事情,但是我想知道是否可以使用Spring Security插件来做到这一点。
最佳答案
将这两个加起来应该可以做到:
'/user/showIdentity': ['permitAll'],
'/user/showIdentity.*': ['permitAll'],
像
/user/showIdentity.xml
这样的请求需要第二个。其他/user/**
请求将通过/**
规则进行匹配。
关于grails - 使用Grails Spring Security插件中的interceptMap允许方法公开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21792043/