Hi,

In order to log the user in automatically after signup, I discovered that I
needed to place the SecurityContext in the session. I did this by changing
the following code in SignupController:

        // log user in automatically
        UsernamePasswordAuthenticationToken auth = new
UsernamePasswordAuthenticationToken(
                user.getUsername(), user.getConfirmPassword(),
user.getAuthorities());
        auth.setDetails(user);
        SecurityContextHolder.getContext().setAuthentication(auth);

To:

        // log user in automatically
        UsernamePasswordAuthenticationToken auth = new
UsernamePasswordAuthenticationToken(
                user.getUsername(), user.getConfirmPassword(), 
user.getAuthorities());
        auth.setDetails(user);
        SecurityContext context = SecurityContextHolder.getContext();
        context.setAuthentication(auth);
        request.getSession().setAttribute("ACEGI_SECURITY_CONTEXT", context);

Hope this helps someone!

Greg
-- 
View this message in context: 
http://www.nabble.com/SecurityContext-in-session-required-to-log-user-in-automatically-tf4477004s2369.html#a12765660
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to