Once again, thanks for the excellent product and the quick feedback. A big win in migrating my legacy application security infrastructure to Acegi Security is that the SwitchUser functionality offers more functionality out of the box than the legacy implementation. Whereas the legacy implementation did not remember who switched in the first place, I now have "exitUser", which allows users to switch multiple times within a session. Very nice.
Once again I encountered an issue related to my custom UserDetails implementation. When performing the exitUser function, I experienced strange behavior. The application would log me out where I expected to receive the "switch user" prompt. Inspecting the logs I found the following runtime exception. java.lang.IllegalArgumentException: User is required at org.springframework.util.Assert.notNull(Assert.java:90) at net.sf.acegisecurity.providers.dao.event.AuthenticationEvent.<init>(AuthenticationEvent.java:57) at net.sf.acegisecurity.providers.dao.event.AuthenticationSwitchUserEvent.<init>(AuthenticationSwitchUserEvent.java:40) at net.sf.acegisecurity.ui.switchuser.SwitchUserProcessingFilter.attemptExitUser(SwitchUserProcessingFilter.java:272) at net.sf.acegisecurity.ui.switchuser.SwitchUserProcessingFilter.doFilter(SwitchUserProcessingFilter.java:213) Upon investigation I learned that the SwitchUserProcessingFilter was passing a null parameter to the AuthenticationSwitchUserEvent constructor because my UserDetails was not a net.sf.acegisecurity.providers.dao.User. I updated my copy to check for UserDetails rather than User and it works great. All the tests pass as well without further modification. I have included the patch below. Regards, Matt DeHoust Index: SwitchUserProcessingFilter.java =================================================================== RCS file: /cvsroot/acegisecurity/acegisecurity/core/src/main/java/net/sf/acegisecurity/ui/switchuser/SwitchUserProcessingFilter.java,v retrieving revision 1.5 diff -u -r1.5 SwitchUserProcessingFilter.java --- SwitchUserProcessingFilter.java 19 Sep 2005 02:22:43 -0000 1.5 +++ SwitchUserProcessingFilter.java 20 Sep 2005 01:38:45 -0000 @@ -26,7 +26,6 @@ import net.sf.acegisecurity.context.SecurityContextHolder; import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken; import net.sf.acegisecurity.providers.dao.AuthenticationDao; -import net.sf.acegisecurity.providers.dao.User; import net.sf.acegisecurity.providers.dao.UsernameNotFoundException; import net.sf.acegisecurity.providers.dao.event.AuthenticationSwitchUserEvent; import net.sf.acegisecurity.ui.WebAuthenticationDetails; @@ -263,8 +262,8 @@ UserDetails originalUser = null; Object obj = original.getPrincipal(); - if ((obj != null) && obj instanceof User) { - originalUser = (User) obj; + if ((obj != null) && obj instanceof UserDetails) { + originalUser = (UserDetails) obj; } // publish event ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Home: http://acegisecurity.sourceforge.net Acegisecurity-developer mailing list Acegisecurity-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer