« Return to Thread: Programmatically detecting login or logout events

Re: Programmatically detecting login or logout events

by MartinOShea :: Rate this Message:

Reply to Author | View in Thread


markt-2 wrote:
MartinOShea wrote:
> I have used request.getRemoteUser() at various points in the application to
> identify the current user when they are authenticated by Apache Tomcat.
> However, request.getRemoteUser() does not tell me when the  user logged in
> or off.
request.getRemoteUser() tells you if the user is authenticated.

> Does anyone know a way that the login and logout events can be recorded by
> an event in a program, a session object and so on?
Have you looked at session listeners?

It depends what you mean by login and logout.
If login is the transition from request.getRemoteUser()==null to
request.getRemoteUser()!=null and logout is when the session is invalidated
then a combination of request.getRemoteUser() and a session listener should
be all you need.

Mark



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

Mark

By login or logout, I mean the actual physical login and logout actions by the user concerned which I expect translate to request.getRemoteUser()==null for logout and request.getRemoteUser()!=null for login. But I'm not familiar with session listeners so I will be looking at them later.

Do you have any sample code at all?

Thanks

Martin O'Shea.

 « Return to Thread: Programmatically detecting login or logout events