How To Save Spring Security Logged In User In Session

Posted by Brad Rhoads on Stack Overflow See other posts from Stack Overflow or by Brad Rhoads
Published on 2010-05-30T06:27:28Z Indexed on 2010/05/30 6:32 UTC
Read the original article Hit count: 411

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about grails

Related posts about spring-security