Hi,
Currently the mechanism for accessing the authentication object as described in the users guide is the following:
This is contrary to the hollywood principle.Code:Object obj = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (obj instanceof UserDetails) { String username = ((UserDetails)obj).getUsername(); } else { String username = obj.toString(); }
I think that by using custom bean scopes in Spring 2.0 it would be possible to DI an authentication object into any bean and avoid the evil Singleton pattern.
What do you guys think? Has this been discussed before?
Regards,


