public User getUserFromSession() {
SecurityContext context = SecurityContextHolder.getContext();
Authentication authentication = context.getAuthentication();
Object principal = authentication.getPrincipal();
if (principal instanceof CineastsUserDetails) {
CineastsUserDetails userDetails = (CineastsUserDetails) principal;
return userDetails.getUser();
}
return null;
}