How To Save Spring Security Logged In User In Session
- by Brad Rhoads
This code get's the currently logged in user, using the Spring Security Plugin (acegi):
def principalInfo = authenticateService.principal()
def person = null
if (principalInfo != "anonymousUser" && principalInfo.username) {
person = Person.findByUsername(principalInfo.username)
}
I would like then do:
session.user = person
This needs to be done after the user logs in. I can't figure out where to put my code to do this. It seem like it should be some place in the Login Controller, but I can't see where.