且构网

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

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

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

我正在使用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()
     .....
     .....
  } 
}