what's the authentication object saved in session after logon?
what's the authentication object saved in session after logon?
See HttpSessionContextIntegrationFilter, which also provides an ACEGI_SECURITY_CONTEXT_KEY for your convenience.
what's the type of object stored in session?
is it myself implemented UserDetails?
Your UserDetails (as returned by AuthenticationDao) is accessible from the Authentication object's getPrincipal() method. You can get the Authentication from the ContextHolder. Please note from 0.9.0 (and current CVS) the ContextHolder has been refactored and you'll need to use SecurityContext.getAuthentication() instead.
could you show me a exmaple?
such as
ContextHolder ccc = (ContextHolder)session.getAttribute("KEY")
ccc.getXXX
to get myself UserDetailsImpl Object
thanks.
For release 0.8.2 and earlier:
For release 0.9.0 and above (and current CVS):Code:UserDetails userDetails = (UserDetails) ((SecureContext)ContextHolder.getContext()).getAuthentication().getPrincipal()
Code:UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()