@RolesAllowed({"ROLE_USER"}) @POST public ReportResponse createReport(@Context SecurityContext context, CreateReportRequest request) throws EntityException { if (request == null) { throw new NullParametersException("report"); } User user = loadUserFromSecurityContext(context); if (user != null) { log.info("creating report [" + request.getName() + "] by [" + user.getId() + "]"); ReportResponse reportResponse = reportService.createReportFromRequest(request); return reportResponse; } else { log.info("rejected unauth user creating report action"); throw new UnauthorizedUserException("you don't have permit to create reports"); } }