Hi,

I'm guessing there's no 'official' mechanism within the servlet spec to identify when a user has logged in. I've looked at the session lifecycle events but these relate to creating and destroying sessions http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionListener.html which happen independently of login.

Is there a prefered mechanism to detect when login occurs? I'd like to set up various state variables and log the user login when a user logs in.

This is a solution I'm thinking of implementing.

1) Have a filter that detects the absence of a session variable.
2) If the variable is missing, call request.getUserPrincipal();
3) If user principal returned then user has logged in, set up vars log login etc.
4) If no user returned.  User has not yet logged in.

I'd be interested to hear how others have solved this problem.

I use my own implementation of a Realm class so I can detect login here but the Realm api has no access to the session or request so that doesn't really help.

cheers
Nathan

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

Reply via email to