gpt4 book ai didi

grails - Grails Spring Security InterceptUrlMap无法正常工作

转载 作者:行者123 更新时间:2023-12-02 14:50:52 26 4
gpt4 key购买 nike

我将Siteminder与一个应用程序一起使用,但正在使用Spring Security核心插件来管理安全性的所有其他方面。我并没有被某些需要特定角色的资源所阻止,尽管如果尝试访问该URL,我会被踢到requestHeaderAuthenticationFilter。

配置槽

...    
grails.plugin.springsecurity.securityConfigType = grails.plugin.springsecurity.SecurityConfigType.InterceptUrlMap
grails.plugin.springsecurity.providerNames = ['preauthAuthProvider', 'anonymousAuthenticationProvider']
grails.plugin.springsecurity.filterNames = ['anonymousAuthenticationFilter','requestHeaderAuthenticationFilter']
grails.plugin.springsecurity.filterChain.filterNames = ['anonymousAuthenticationFilter','requestHeaderAuthenticationFilter']
grails.plugin.springsecurity.filterChain.chainMap = [
'/assets/**': 'anonymousAuthenticationFilter',
'/public/**': 'anonymousAuthenticationFilter',
'/auth/**': 'requestHeaderAuthenticationFilter'
]
grails.plugin.springsecurity.x509.checkForPrincipalChanges = 'true'
grails.plugin.springsecurity.logout.afterLogoutUrl='/public/'
grails.plugin.springsecurity.successHandler.defaultTargetUrl = '/auth/home'

grails.plugin.springsecurity.interceptUrlMap = [
'/auth/admin': ['ROLE_SYSTEM_ADMIN'],
'/auth/constant/**': ['ROLE_SYSTEM_ADMIN'],
'/assets/**': ['IS_AUTHENTICATED_ANONYMOUSLY'],
'/public/**': ['IS_AUTHENTICATED_ANONYMOUSLY'],
'/auth/**': ['IS_AUTHENTICATED_FULLY']
]

当我使用taglib是否显示到这些链接时,它按预期工作:
<sec:ifAnyGranted roles="ROLE_SYSTEM_ADMIN">
<g:link uri="/auth/admin">Admin</g:link>
</sec:ifAnyGranted>

我在URLMappings中将所有内容归为一组:
static mappings = {
group("/auth") {
"/constant/$action?/$id?(.${format})?"(controller: 'constant')
"/admin"(view:'/admin')
"/"(controller:'index',action:'home')
"/home"(controller:'index',action:'home')
}
group("/public") {
"/"(controller:'index',action:'public')
"/index"(controller:'index',action:'public')
}
}

因此,该标签似乎正常工作,但是我仍然可以正常访问该链接,这意味着我的设置必须在某个地方弄乱了。

Grails 2.4.3

Spring 安全核心2.0-RC4

最佳答案

grails.plugin.springsecurity.securityConfigType = "InterceptUrlMap"

通过在您的config.groovy中编辑此行可以帮助我

关于grails - Grails Spring Security InterceptUrlMap无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30355858/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com