Meaningless Drivel is fun!*
The moose likes Spring and the fly likes after advice to j_security check Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "after advice to j_security check" Watch "after advice to j_security check" New topic
Author

after advice to j_security check

vik ar
Ranch Hand

Joined: Jul 31, 2009
Posts: 104
Hi

I have a login html page using j_security_check. My web.xml as follows



As you can see LoggedIn.action and LoggedInTwo.action are secure actions. What I want is that after the user logs in a session variable is created containing the users name. Does anyone know if its possible to apply Spring AOP after advice to j_security_check? Or I could apply aop before advice to the secure action classes, however will the request parameter j_username be accessible in my before advice class???
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

You can customize all the parts of Spring Security. If you just create a UserDetails class and put the value in that, then you don't have to put it into the session, and in jsp pages and in code you have access to the value with the SpringSecurityContextUtil class and with the security tag lib.

This is exactly what we do here, we have the UserDetails object also hold our User object, and we can get access to the values in the User object. Heck if you use Groovy you can put an @Delegate on the User object and call the getters and setters directory from the UserDetails instance.

Mark


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

Joined: Jul 31, 2009
Posts: 104
The following appears to get me the username which is all I want

Very simple
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: after advice to j_security check