RE: Getting the authenticated user from Spring Security for use in an Action

2010-03-17 Thread Hoying, Ken
Try: SecurityContextHolder.getContext().getAuthentication().getPrincipal() -Original Message- From: Lance Hill [mailto:la...@baldhead.com] Sent: Tuesday, March 16, 2010 5:15 PM To: 'Struts Users Mailing List' Subject: Getting the authenticated user from Spring Security for use in an

RE: Getting the authenticated user from Spring Security for use in an Action

2010-03-17 Thread Lance Hill
I tried using that, but SecurityContextHolder.getContext() returns a null value. Any thoughts on how to fix that? -Original Message- From: Hoying, Ken [mailto:ken_hoy...@premierinc.com] Sent: Wednesday, March 17, 2010 7:36 AM To: Struts Users Mailing List Subject: RE: Getting the

Re: Getting the authenticated user from Spring Security for use in an Action

2010-03-16 Thread Wes Wannemacher
What mechanism are you using to handle authentication/authorization? -Wes On Tue, Mar 16, 2010 at 5:14 PM, Lance Hill la...@baldhead.com wrote: I need to access information about the currently logged in user. I don't think putting the user into the session during login is how it is supposed

RE: Getting the authenticated user from Spring Security for use in an Action

2010-03-16 Thread Lance Hill
I have Spring Security set up to use CasAutheticationProvider to provide a UserDetails object. I did find an example that uses the SecurityContext to obtain an Authentication object and grab the UserDetails from there. I am not sure how to get access to the populated SecurityContext since

Re: Getting the authenticated user from Spring Security for use in an Action

2010-03-16 Thread Wes Wannemacher
I use - SecurityContextHolder.getContext().getAuthentication() I assume that if the object returned is null, then the user isn't logged in. I am using spring-security 2.0.4. -Wes On Tue, Mar 16, 2010 at 5:42 PM, Lance Hill la...@baldhead.com wrote: I have Spring Security set up to use

RE: Getting the authenticated user from Spring Security for use in an Action

2010-03-16 Thread Lance Hill
I used the same method to obtain the Authentication, but it returns as null. The user is logged in since it gets to the protected page I am accessing. Any thoughts on how to get the properly populated SecurityContext? -Original Message- From: Wes Wannemacher [mailto:w...@wantii.com]