File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Log user authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Log user authentication" Watch "Log user authentication" New topic
Author

Log user authentication

James Daniel
Ranch Hand

Joined: Sep 24, 2004
Posts: 79
I am using Spring Security 3.0.4 and would like to log when a user successfully logs in. What is the best way to do this?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

James Daniel wrote:I am using Spring Security 3.0.4 and would like to log when a user successfully logs in. What is the best way to do this?


Which UserDetailsService are you using. You can always customize it yourself. You can either implement UserDetailsService interface, it just has one method. Or you can extend the UserDetailsService you are using, have the first line of code call super.loadUserByUserName(userName) then the code after logs a message.

Or you can try using Spring AOP and define a pointcut expression that matches loadUserByUserName. and do an AfterSuccessful advice type.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
James Daniel
Ranch Hand

Joined: Sep 24, 2004
Posts: 79
Mark,

Thanks so much for the information. Sounds like either will work out for me. I'll give them a try.

Jim
 
Don't get me started about those stupid light bulbs.
 
subject: Log user authentication
 
Similar Threads
midlet as resident program
Strange error getting on the console
Mozilla Java plugin Problems
Develop an application like JConsole
MySql 5.1.48 GRANT problems