List of usage examples for java.security Principal getName
public String getName();
From source file:alfio.controller.api.admin.EmailMessageApiController.java
@RequestMapping("/{messageId}") public LightweightEmailMessage loadEmailMessage(@PathVariable("eventName") String eventName, @PathVariable("messageId") int messageId, Principal principal) { Event event = eventManager.getSingleEvent(eventName, principal.getName()); return notificationManager.loadSingleMessageForEvent(event.getId(), messageId) .map(m -> new LightweightEmailMessage(m, event.getZoneId(), false)) .orElseThrow(IllegalArgumentException::new); }
From source file:com.dub.skoolie.web.controller.admin.school.AdminSchoolController.java
@Secured("ROLE_SCHOOL_ADMIN") @RequestMapping(value = "/admin/school") public ModelAndView getSchool(Model model, Principal principal) { // need to figure out how I'm going to associate users with schools still String username = principal.getName(); String id = username;// w w w .j ava 2s. co m return new ModelAndView("redirect://admin/schools/" + id); }
From source file:org.mitreid.multiparty.service.InMemoryResourceService.java
@Override public void unshareResourceSet(Principal p) { sharedResourceSets.remove(p.getName()); }
From source file:com.github.jguaneri.notifications.web.controller.AccountManagementController.java
@RequestMapping(value = "/channel/{channelId}") public String getChannelAdmin(@PathVariable("channelId") String channelId, Model model, Principal principal) throws ChannelException { User user = userService.retrieveUserByName(principal.getName()); Channel channel = channelService.retrieveChannelById(channelId); if (!user.equals(channel.getCreatedByUser())) { throw new ChannelException("Channel for user cannot be found."); }//w ww . jav a2 s. c o m model.addAttribute("channel", channel); return "manage/channel"; }
From source file:com.msgilligan.bitcoinj.spring.service.PeerService.java
public void listPeers(Principal principal) { List<Peer> peers = peerGroup.getConnectedPeers(); this.messagingTemplate.convertAndSendToUser(principal.getName(), "/queue/peers", peers); }
From source file:alfio.controller.api.admin.EmailMessageApiController.java
@RequestMapping("/") public PageAndContent<List<LightweightEmailMessage>> loadEmailMessages( @PathVariable("eventName") String eventName, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "search", required = false) String search, Principal principal) { Event event = eventManager.getSingleEvent(eventName, principal.getName()); ZoneId zoneId = event.getZoneId(); Pair<Integer, List<LightweightMailMessage>> found = notificationManager .loadAllMessagesForEvent(event.getId(), page, search); return new PageAndContent<>(found.getRight().stream().map(m -> new LightweightEmailMessage(m, zoneId, true)) .collect(Collectors.toList()), found.getLeft()); }
From source file:com.example.okta.TokenValidation.java
@RequestMapping(value = "/protected", method = RequestMethod.GET) public Map<String, String> resource(Principal principal) { Map<String, String> response = new HashMap(); if (principal != null) { response.put("image", this.getGravatar(principal.getName())); response.put("name", principal.getName()); } else {/*www . j a va2s . c o m*/ response.put("error", principal.getName()); } return response; }
From source file:org.terasoluna.gfw.functionaltest.app.redirect.RedirectController.java
@RequestMapping(value = "detail/{id}", method = RequestMethod.GET) public String detail(Principal principal, DetailForm form, Model model) { UserInfo user = redirectService.findOne(principal.getName()); form.setName(user.getName());//ww w.jav a 2s . c o m form.setAddress(user.getAddress()); model.addAttribute(form); return "redirect/detail"; }
From source file:alfio.controller.api.admin.SpecialPriceApiController.java
@RequestMapping(value = "/events/{eventName}/categories/{categoryId}/codes/{codeId}/recipient", method = RequestMethod.DELETE) public boolean clearRecipientData(@PathVariable("eventName") String eventName, @PathVariable("categoryId") int categoryId, @PathVariable("codeId") int codeId, Principal principal) { return specialPriceManager.clearRecipientData(eventName, categoryId, codeId, principal.getName()); }
From source file:com.epam.ta.reportportal.ws.controller.impl.DashboardController.java
@Override @RequestMapping(method = RequestMethod.GET) @ResponseStatus(OK)//from ww w . j a va 2 s.c om @ResponseBody @ApiOperation("Get all dashboard resources for specified project") public Iterable<DashboardResource> getAllDashboards(@PathVariable String projectName, Principal principal) { return getHandler.getAllDashboards(principal.getName(), EntityUtils.normalizeProjectName(projectName)); }