aspose file tools*
The moose likes Struts and the fly likes Unit Testing Struts 2 Actions that use Spring Security Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unit Testing Struts 2 Actions that use Spring Security" Watch "Unit Testing Struts 2 Actions that use Spring Security" New topic
Author

Unit Testing Struts 2 Actions that use Spring Security

James Gadbury
Greenhorn

Joined: Mar 20, 2009
Posts: 24
Hi all,

I am looking to unit test my Struts actions (currently using the Struts JUnit plugin (and my test classes extend StrutsTestCase). At the moment, my actions have nasty static calls to the get the Principal, such as:



My actions implement various interfaces such as SessionAware to make my unit-testing life easier. However, does implementing the PrincipalAware interface compromise security? For example, by implementing the PrincipalAware interface, I have to implement a setter for the PrincipalProxy. Is there not a risk that a user could alter security and set this themselves?

Thanks for reading. Kind regards,

James
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unit Testing Struts 2 Actions that use Spring Security