Try this-
        // Log in the registered user and set their active permissions        
Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
       // add privs during signup request

       GrantedAuthority[] grantedAuthorityArray = authorities                
.toArray(new GrantedAuthority[authorities.size()]);        
UsernamePasswordAuthenticationToken token            = new 
UsernamePasswordAuthenticationToken(                new 
org.springframework.security.userdetails.User(email id, emaiI id, true, true, 
true, true,                    grantedAuthorityArray), email id,                
    grantedAuthorityArray);        token.setDetails(vericalUser.getUniqueId()); 
       SecurityContextHolder.getContext().setAuthentication(token);

This is the code which I used to add a user to security context during signup.

-Chandan Benjaram



On 3/21/09 9:49 AM, "Michiel Trimpe" <mich...@trimpe.nl> wrote:

Hey everyone,

How do I make sure that a user is logged in immediately after signing up?

I already have a controller that handles the signup request and forwards the 
user to another page but I can't find a way to prevent the user from having to 
log in immediately after signing up.

After a lot of probing I've already found the AuthenticationManager and I guess 
I could use a UsernamePasswordAuthenticationToken to log the user in but I 
can't find out how I would get the login information registered in the session.

Does anyone know if there's a simple way to do this or if no-one knows, does 
anyone know what code is responsible for setting the right parameters in the 
user session?

Kind regards,

Michiel Trimpe

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to