List of usage examples for java.security Principal getName
public String getName();
From source file:alfio.controller.api.admin.SpecialPriceApiController.java
@RequestMapping(value = "/events/{eventName}/categories/{categoryId}/send-codes", method = RequestMethod.POST) public boolean sendCodes(@PathVariable("eventName") String eventName, @PathVariable("categoryId") int categoryId, @RequestBody List<SendCodeModification> codes, Principal principal) throws IOException { Validate.isTrue(StringUtils.isNotEmpty(eventName)); Objects.requireNonNull(codes); Validate.isTrue(!codes.isEmpty(), "Collection of codes cannot be empty"); specialPriceManager.sendCodeToAssignee(codes, eventName, categoryId, principal.getName()); return true;// w w w. j a va 2s . c om }
From source file:org.geosdi.geoplatform.experimental.dropwizard.resources.secure.folder.GPSecureFolderResource.java
@GET @Path(value = GPServiceRSPathConfig.GET_SHORT_FOLDER_PATH) @Override/*from ww w . j av a2s . com*/ public FolderDTO getShortFolder(@Auth Principal principal, @PathParam(value = "folderID") Long folderID) throws Exception { logger.debug("\n\n@@@@@@@@@@@@@@@@@Executing secure getShortFolder " + "- Principal : {}\n\n", principal.getName()); return super.getShortFolder(folderID); }
From source file:internal.TweetsController.java
@RequestMapping(value = "/", method = RequestMethod.POST) public String postTweet(Principal principal, @RequestParam("body") String body) { if (principal != null && body != null && !body.isEmpty()) { LOG.info("saving tweet by {}: {}", principal.getName(), body); m_tweetRepository.saveTweet(principal.getName(), body); }/*from w w w . ja v a 2 s. c om*/ return "redirect:/"; }
From source file:org.geosdi.geoplatform.experimental.dropwizard.resources.secure.folder.GPSecureFolderResource.java
@GET @Path(value = GPServiceRSPathConfig.GET_FOLDER_DETAIL_PATH) @Override/*from w ww. j a v a2s.co m*/ public GPFolder getFolderDetail(@Auth Principal principal, @PathParam(value = "folderID") Long folderID) throws Exception { logger.debug("\n\n@@@@@@@@@@@@@@@@@Executing secure getFolderDetail " + "- Principal : {}\n\n", principal.getName()); return super.getFolderDetail(folderID); }
From source file:alfio.controller.api.admin.ConfigurationApiController.java
@RequestMapping(value = "/configuration/events/{eventId}/categories/{categoryId}/update", method = POST) public boolean updateCategoryConfiguration(@PathVariable("categoryId") int categoryId, @PathVariable("eventId") int eventId, @RequestBody Map<ConfigurationKeys.SettingCategory, List<ConfigurationModification>> input, Principal principal) { configurationManager.saveCategoryConfiguration(categoryId, eventId, input.values().stream().flatMap(Collection::stream).collect(Collectors.toList()), principal.getName()); return true;/*from w w w . j a v a 2 s. c o m*/ }
From source file:pdl.web.controller.rest.RestMainController.java
/** * update job status to completed// www .j a v a 2s .co m * @param jobId job UUID * @return result in json format * @format curl <ip address>:<port>/pdl/r/status/complete?jid=<jobid> -u <user id>:<pass> -X POST|GET */ @RequestMapping(value = "status/complete", method = { RequestMethod.POST, RequestMethod.GET }) public @ResponseBody Map<String, String> setJobComplete( @RequestParam(value = "jid", defaultValue = "") String jobId, @RequestParam(value = "result", defaultValue = "") String resultFileId, Principal principal) { Map<String, String> jsonResult = handler.updateJob(jobId, StaticValues.JOB_STATUS_COMPLETED, resultFileId, principal.getName()); return jsonResult; }
From source file:alfio.controller.api.admin.ConfigurationApiController.java
@RequestMapping(value = "/configuration/organizations/{organizationId}/update", method = POST) public boolean updateOrganizationConfiguration(@PathVariable("organizationId") int organizationId, @RequestBody Map<ConfigurationKeys.SettingCategory, List<ConfigurationModification>> input, Principal principal) { configurationManager.saveAllOrganizationConfiguration(organizationId, input.values().stream().flatMap(Collection::stream).collect(Collectors.toList()), principal.getName()); return true;/*from www . ja v a 2 s .c o m*/ }
From source file:org.magnum.mobilecloud.video.VideoLikeController.java
@RequestMapping(value = VideoSvcApi.VIDEO_SVC_PATH + "/{id}/like", method = RequestMethod.POST) public void likeVideo(@PathVariable("id") long id, Principal p, HttpServletResponse resp) { Video v = videos.findOne(id);/*w ww .j ava 2 s . co m*/ if (v == null) { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } else { Set<String> likedUsernames = v.getLikedUsernames(); String username = p.getName(); if (likedUsernames.contains(username)) { resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else { likedUsernames.add(username); v.setLikedUsernames(likedUsernames); v.setLikes(likedUsernames.size()); videos.save(v); } } }
From source file:org.magnum.mobilecloud.video.VideoLikeController.java
@RequestMapping(value = VideoSvcApi.VIDEO_SVC_PATH + "/{id}/unlike", method = RequestMethod.POST) public void unlikeVideo(@PathVariable("id") long id, Principal p, HttpServletResponse resp) { Video v = videos.findOne(id);//from w w w. j a v a 2s .c o m if (v == null) { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } else { Set<String> likedUsernames = v.getLikedUsernames(); String username = p.getName(); if (!likedUsernames.contains(username)) { resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); } else { likedUsernames.remove(username); v.setLikedUsernames(likedUsernames); v.setLikes(likedUsernames.size()); videos.save(v); } } }
From source file:com.jd.survey.web.security.DepartmentController.java
@Secured({ "ROLE_ADMIN" }) @RequestMapping(value = "/{id}", params = "form", produces = "text/html") public String updateForm(@PathVariable("id") Long id, Principal principal, Model uiModel) { log.info("updateForm(): id=" + id); try {//from w w w . j ava2 s.co m User user = userService.user_findByLogin(principal.getName()); populateEditForm(uiModel, surveySettingsService.department_findById(id), user); return "security/departments/update"; } catch (Exception e) { log.error(e.getMessage(), e); throw (new RuntimeException(e)); } }