public class SpringUserService implements UserService {
public User getCurrentUser() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null || !(authentication.getPrincipal() instanceof UserDetails)) {
return new User("");
}
return new User(((UserDetails) authentication.getPrincipal()).getUsername());
}