PDA

View Full Version : How to make User object available in HttpSession



vishwanath13
Dec 17th, 2007, 03:13 AM
Hi All,

I need some help in making the User object in http session. I want to maintain the User object through out the http session till user logs out from the application.

Please do response & reply to this mail ASAP...

Thanks
Vishwanath

karldmoore
Dec 17th, 2007, 07:02 AM
I'm not sure I understand what you are getting at, Acegi stores information in the session anyway.

vishwanath13
Dec 17th, 2007, 07:14 AM
Hi Karl Moore,

Thanks for the reply, even I want to know the same. I am using DAO Authentication, actually I need to pass and maintain the User Credential across all the modules in my application till user logs out from the application. I need help, that how to retrieve the user information in action after user login. I am able to do in the jsp using <authz:authentication /> tag. I want to do this actions. Whats the best way...

As I am not understanding how to pick user information from http session in action, I requested. Can you please help me further in doing so...

Thanks Vishwanath

sambrodkin
Dec 17th, 2007, 08:15 AM
It sounds like you want a custom user object in Thread.local via ACEGI.

See if this helps:

http://www.javalobby.org/java/forums/t91426.html

vishwanath13
Dec 17th, 2007, 09:18 PM
Hi Rotterdamsam,

I could able to retrive user data in jsp using <authz:authentication /> tag.
My question is how to retrieve the same data in actions...

Thanks Vishwanath

sambrodkin
Dec 19th, 2007, 02:18 AM
Try this:

SecurityContext securityContext = SecurityContextHolder.getContext();
Authentication auth = securityContext.getAuthentication();
Object user = auth.getPrincipal();