【发布时间】:2017-10-04 08:05:31
【问题描述】:
我的application.yml上有这个:
grails.plugin.springsecurity.successHandler.alwaysUseDefault = true
grails.plugin.springsecurity.successHandler.defaultTargetUrl = '/l/loggedIn'
l/loggedIn 看起来像:
def loggedIn() {
User user = springSecurityService.currentUser
def roleDefault = Role.findByAuthority("ROLE_DEFAULT")
if(user.authorities.contains(roleDefault))
redirect(controller: 'foo', action:'index')
def roleAdmin = Role.findByAuthority("ROLE_ADMIN")
if(user.authorities.contains(roleAdmin))
redirect(view: 'index')
}
当我在我的应用程序中以admin 登录时,我收到ERR_TOO_MANY_REDIRECTS 错误。
有什么办法解决这个问题?
更新
@Secured(["ROLE_ADMIN", "ROLE_DEFAULT"])
class FooController {
def index() {}
}
【问题讨论】:
-
它只发生在管理员用户@AdeelAnsari
标签: redirect grails spring-security controller