This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm using Spring 3.1.0.RELEASE and Spring security 3.1. To better help with JUnittesting, I was told I can inject my Princpal object into my controller methods ...
The problem is I can no longer get back to my original UserDetails object that I logged in with. I get a ClassCastException on the "final Registration currentUser = (Registration) principal" line above. Before, I used
and everything worked like a dream, except I couldn't easily do JUnit testing. How do I get my UserDetails object from an injected Principal? Here is the domain object I'm logging in with ...
Joined: Jul 02, 2008
To get a UserDetails object from a Principal object use
Now with all the extra time you've saved by finding this answer, you can go back to checking your MyLife account, -