Hi Richard,

Gareth Davis wrote:
Authentication.getPrincipal() is your friend here.

On 5 Feb 2008, at 06:05, [EMAIL PROTECTED] wrote:
Yes, that was referred to earlier and I did check out the code in
UserSecurityAdvice.

The code in UserSecurityAdvice uses SecurityContextHolder to return a
SecurityContext that in turn returns an Authorization. From this the
getDetails() method returns the IP address and session id, as in:

auth.details='[EMAIL PROTECTED]:
RemoteIpAddress: 127.0.0.1; SessionId: cfcczg0dp2y3'

The "before" method in UserSecurityAdvice does work with the User object,
but only as a passed in parameter:

User user = (User) args[0];

So, I'm still missing something as far as how to get the logged in User
object using SecurityContextHolder.

Thanks to all for the guidance and patience. I'm almost there.
If you run a debugger over your AuditInfoListenerBean during a successful login and look inside the event object that's passed in, you'll find a complete user object in there somewhere - I remember seeing it when I was debugging my own listener. Don't have access to my own app ATM or I'd look it up so I could be more specific :-( .

HTH,

Rob Hills
Waikiki Western Australia

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

Reply via email to