I have times trying to extract the current user to be able to make a comparison in my controller so that only the user who made it can delete a reservation. But I have not found a way to get that user, any ideas?
Controller
@RequestMapping(value = "/EliminarRESAU.do", method = RequestMethod.GET)
public String borrarRESA(ModelMap model,@RequestParam("id") Long idRESA ) throws Exception {
try {
RESA resa = resaBo.obtener(idRESA);
if (!resa.getEstado().equals("Activa")) {
JOptionPane.showMessageDialog(null,"1");
return "redirect:ListarRESAU.do";
}
if (resa.getEstado().equals("Activa")) {
JOptionPane.showMessageDialog(null,resa.getUsuario().getParticipante());
return "redirect:ListarRESAU.do";
}else{
JOptionPane.showMessageDialog(null,"3");
return "redirect:ListarRESAU.do";}
} catch (Exception e) {
throw e;
}
}