Grails and Spring Security: How do I get the authenticated user from a controller?

advertisements

I recently moved from the JSecurity plugin to Spring Security. How do I get the authenticated user from within my controllers?


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()
     .....
     .....
  }
}