0
我寫了一個簡單的hello世界項目使用彈簧安全核心。基本上我有一個安全註釋的控制器。該項目沒有建立...找不到類... org.springframework.security.core.GrantedAuthority
package springsecuritytest
import grails.plugin.springsecurity.annotation.Secured
@Secured(['ROLE_ADMIN'])
class HelloController {
def index() {
render "this is public"
}
def logout(){
}
}
因此,該應用程序符合並正常工作。當我嘗試訪問索引頁時,它會要求我登錄,只有當我有管理員角色時,我才允許訪問該頁面。
現在,我增加對註銷一個simpe代碼,我碰到下面的錯誤
package springsecuritytest
import grails.plugin.springsecurity.annotation.Secured
import grails.plugin.springsecurity.SpringSecurityUtils
@Secured(['ROLE_ADMIN'])
class HelloController {
def index() {
render "this is public"
}
def logout(){
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl
}
}
我得到的錯誤如下:
The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.security.core.GrantedAuthority. Fix the build path then try building this project
我明白任何幫助!謝謝!