Code snippet to retrieve user credentials anywhere in the code:
SecurityContextHolder
.setStrategyName(SecurityContextHolder
.MODE_INHERITABLETHREADLOCAL);
Object principal = SecurityContextHolder
.getContext().getAuthentication()
.getPrincipal();
principal is then to be cast to the implementation returned by
MyImplementationOfUserDetailsService
.loadUserByUsername(final String username)