Spring 安全性 URL 映射 Grails
Spring Security URL Mapping Grails
我已经设置了 Spring 安全核心插件。我想将它用于用户模块。设置之后,所有 URL 都不起作用,我的所有页面都被重定向到 /login/auth
页面。我的默认页面是 home/index
。另外,如何使用登录页面的自定义设计?
这里是Config.groovy
grails.plugin.springsecurity.userLookup.userDomainClassName = 'nfp.NfpUser'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'nfp.NfpUserNfpRole'
grails.plugin.springsecurity.authority.className = 'nfp.NfpRole'
//grails.plugin.springsecurity.interceptUrlMap=[ '/': ['IS_AUTHENTICATED_ANONYMOUSLY'], '/**': ['IS_AUTHENTICATED_FULLY'] ]
//grails.plugin.springsecurity.rejectIfNoRule = true
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
'/': ['permitAll'],
'/index': ['permitAll'],
'/index.gsp': ['permitAll'],
'/assets/**': ['permitAll'],
'/**/js/**': ['permitAll'],
'/**/css/**': ['permitAll'],
'/**/images/**': ['permitAll'],
'/**/favicon.ico': ['permitAll']
]
而不是使用 /
,使用 /**
并且只限制你想要的几个模块:
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
'/user/list': ['ROLE_USER_MODULE']
'/**': ['permitAll'],
'/index': ['permitAll'],
'/index.gsp': ['permitAll'],
'/assets/**': ['permitAll'],
'/**/js/**': ['permitAll'],
'/**/css/**': ['permitAll'],
'/**/images/**': ['permitAll'],
'/**/favicon.ico': ['permitAll']
]
现在,如果您使用 grails s2-quickstart nfp NfpUser NfpRole
命令设置插件,您的 Grails 应用目录必须有 grails-app/views/login/auth.gsp
GSP。您可以根据自己的外观自定义 GSP。
如果找不到该 GSP,请从 plugins/spring-security-core-<version>/grails-app/views/login/auth.gsp
复制该 GSP 并自定义它。
我已经设置了 Spring 安全核心插件。我想将它用于用户模块。设置之后,所有 URL 都不起作用,我的所有页面都被重定向到 /login/auth
页面。我的默认页面是 home/index
。另外,如何使用登录页面的自定义设计?
这里是Config.groovy
grails.plugin.springsecurity.userLookup.userDomainClassName = 'nfp.NfpUser'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'nfp.NfpUserNfpRole'
grails.plugin.springsecurity.authority.className = 'nfp.NfpRole'
//grails.plugin.springsecurity.interceptUrlMap=[ '/': ['IS_AUTHENTICATED_ANONYMOUSLY'], '/**': ['IS_AUTHENTICATED_FULLY'] ]
//grails.plugin.springsecurity.rejectIfNoRule = true
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
'/': ['permitAll'],
'/index': ['permitAll'],
'/index.gsp': ['permitAll'],
'/assets/**': ['permitAll'],
'/**/js/**': ['permitAll'],
'/**/css/**': ['permitAll'],
'/**/images/**': ['permitAll'],
'/**/favicon.ico': ['permitAll']
]
而不是使用 /
,使用 /**
并且只限制你想要的几个模块:
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
'/user/list': ['ROLE_USER_MODULE']
'/**': ['permitAll'],
'/index': ['permitAll'],
'/index.gsp': ['permitAll'],
'/assets/**': ['permitAll'],
'/**/js/**': ['permitAll'],
'/**/css/**': ['permitAll'],
'/**/images/**': ['permitAll'],
'/**/favicon.ico': ['permitAll']
]
现在,如果您使用 grails s2-quickstart nfp NfpUser NfpRole
命令设置插件,您的 Grails 应用目录必须有 grails-app/views/login/auth.gsp
GSP。您可以根据自己的外观自定义 GSP。
如果找不到该 GSP,请从 plugins/spring-security-core-<version>/grails-app/views/login/auth.gsp
复制该 GSP 并自定义它。