【发布时间】:2015-02-21 23:12:23
【问题描述】:
我正在为 Grails 使用 spring 安全插件。我可以通过 LDAP 身份验证并查看授权是否正常工作。授权失败时,我会看到“抱歉,您无权查看此页面”。这个错误是从哪里来的?
我的 SecureController 代码如下。
package com.testapp
import grails.plugin.springsecurity.annotation.Secured
import org.springframework.web.context.request.RequestContextHolder
class SecureController {
@Secured(['ROLE_USER'])
def showUser() {
def msg = ' ROLE_USER users see this'
render view: 'enter', model: [msg: msg]
}
@Secured(['ROLE_ADMIN'])
def showAdmin() {
def msg = ' ROLE_ADMIN users see this'
render view: 'enter', model: [msg: msg]
}
}
【问题讨论】:
标签: grails spring-security authorization grails-plugin