@RequestMapping("remove") @ResponseBody public void remove(@RequestBody SessionDTO session) { Session selectedSession = sessionRepository.lookUp(session); if (selectedSession.getUser().getUserName().equalsIgnoreCase(getCurrentUser().getUserName())) { throw new IllegalArgumentException("You can't delete your own session!"); } sessionRepository.remove(selectedSession); }
@ResponseBody @RequestMapping("getCurrentUser") public UserDTO getCurrentUser() { Session session = sessionRepository.findBySSOToken(getSSOToken()); return UserDTOAssembler.assemble(session.getUser()); }
@RequestMapping("removeAllButMine") @ResponseBody public void removeAllButMine() { sessionRepository.removeAllBut(getSSOToken()); }
@ResponseBody @RequestMapping("findAllActive") public Collection<SessionDTO> findAllActive() { return assemble(sessionRepository.findAllActive()); }