You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bret Davies <ju...@co.juneau.wi.us> on 2007/01/30 19:48:54 UTC
tracking user logins
I have a question that I hope you can help me with. We are running tomcat 4.1 and have defined user roles for login on our web page.
http://gis.co.juneau.wi.us/pvweb22/index.htm
we currently have about 30 registered users. I want to be able to track who (by user defined name) logs in and when. Can you help me out or point me in the right direction. .
I am a novice so I don't want to make this too complicated,
Any help would be greatly appreciated
Bret A Davies, LIO
GIS/LIS Coordinator
Juneau County
Land Information Office
220 East State Street, Room 6
Mauston, WI. 53948
608-847-9446
FAX 608-847-9312
juneaulo@co.juneau.wi.us
*** Any Information Contained in this Email is NOT an "OFFICIAL RECORD" of Juneau County. This email has been prepared as a courtesy by the Juneau County Land Information Office. While every effort was made to ensure the accuracy of the content if this email, The user must accept FULL responsibility for any loss or error arising from the use of the information/data. Any use of the information/data provided in this email constitutes agreement to the condition expressed above.***
Re: tracking user logins
Posted by Pid <p...@pidster.com>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bret,
>
> Bret Davies wrote:
>> I want to be able to track who (by user defined name) logs in and
>> when. Can you help me out or point me in the right direction.
>
> I'm assuming that you are using container-manager security -- that is,
> Tomcat is enforcing the authorization and does its own authentication,
> etc. In that case, you can't capture the "login" event itself without
> going pretty far out of your way.
>
> I wanted to do this a while ago and determined that the best solution
> for my needs was to create a filter.
I hacked up the JDBCRealm and had it write a record recording the event
to a log file table after it had finished doing Auth.
Dead easy to swap the tweaked version into the site.
> My filter is applied to all URIs in my application. It checks to see if
> the user is logged-in ("null != request.getUserPrincipal()"), and if
> there is an attribute in the session called "user". If no such attribute
> occurs, I load the user from the database and set the "last login date"
> (as well as put an entry in my login_history table), and then put the
> user object into the session.
>
> This is pretty much the easiest way to do it if you ask me.
>
> Note that you still can't record failed logins, which you may decide to
> do. In order to do that, I chose to switch security mechanisms and
> instead use securityfilter, which mimics the behavior of the
> container-manager authentication and authorization, but is much more
> configurable and pluggable IMO. Using securityfilter, I am able to
> capture failed logins and record them in my database for retrospective
> security auditing without resorting to container-specific code.
>
> Hope that helps,
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFv5ss9CaO5/Lv0PARAqwjAKC+gXnGpYVc7zOwAlIsVD810om2VgCeJBR+
> enx4ZyblEgLl2yeDbEOyEkk=
> =2VHc
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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
>
>
>
---------------------------------------------------------------------
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
Re: tracking user logins
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Bret,
Bret Davies wrote:
> I want to be able to track who (by user defined name) logs in and
> when. Can you help me out or point me in the right direction.
I'm assuming that you are using container-manager security -- that is,
Tomcat is enforcing the authorization and does its own authentication,
etc. In that case, you can't capture the "login" event itself without
going pretty far out of your way.
I wanted to do this a while ago and determined that the best solution
for my needs was to create a filter.
My filter is applied to all URIs in my application. It checks to see if
the user is logged-in ("null != request.getUserPrincipal()"), and if
there is an attribute in the session called "user". If no such attribute
occurs, I load the user from the database and set the "last login date"
(as well as put an entry in my login_history table), and then put the
user object into the session.
This is pretty much the easiest way to do it if you ask me.
Note that you still can't record failed logins, which you may decide to
do. In order to do that, I chose to switch security mechanisms and
instead use securityfilter, which mimics the behavior of the
container-manager authentication and authorization, but is much more
configurable and pluggable IMO. Using securityfilter, I am able to
capture failed logins and record them in my database for retrospective
security auditing without resorting to container-specific code.
Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFv5ss9CaO5/Lv0PARAqwjAKC+gXnGpYVc7zOwAlIsVD810om2VgCeJBR+
enx4ZyblEgLl2yeDbEOyEkk=
=2VHc
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
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