且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Grails 和 Spring Security:如何从控制器中获取经过身份验证的用户?

更新时间:2023-09-07 17:05:28

我使用的是 0.5.1,以下对我有用:

I'm using 0.5.1 and the following works for me:

class EventController {
  def authenticateService

  def list = { 
     def user = authenticateService.principal() 
     def username = user?.getUsername()
     .....
     .....
  } 
}