public void setCurrentUser(UserIndex userIndex) {
IndexedUserDetails userDetails = new IndexedUserDetailsImpl(
_authoritiesService, userIndex);
DefaultUserAuthenticationToken token = new DefaultUserAuthenticationToken(
userDetails);
SecurityContextHolder.getContext().setAuthentication(token);
}