List of usage examples for java.security Principal getName
public String getName();
From source file:alfio.controller.api.admin.UsersApiController.java
@RequestMapping(value = "/users", method = GET) public List<UserWithOrganizations> getAllUsers(Principal principal) { return userManager.findAllUsers(principal.getName()); }
From source file:alfio.controller.api.admin.UsersApiController.java
@RequestMapping(value = "/users/{id}", method = DELETE) public String deleteUser(@PathVariable("id") int userId, Principal principal) { userManager.deleteUser(userId, principal.getName()); return OK;//from www . jav a2 s.c o m }
From source file:com.epam.ta.reportportal.ws.controller.impl.UserFilterController.java
@Override @RequestMapping(value = "/{filterId}", method = RequestMethod.PUT) @ResponseBody/* www . j a v a 2 s . c o m*/ @ResponseStatus(HttpStatus.OK) @ApiOperation("Update specified user filter") public OperationCompletionRS updateUserFilter(@PathVariable String projectName, @PathVariable String filterId, @RequestBody @Validated UpdateUserFilterRQ updateRQ, Principal principal) { return updateUserFilterHandler.updateUserFilter(filterId, updateRQ, principal.getName(), EntityUtils.normalizeProjectName(projectName)); }
From source file:com.notemyweb.controller.RestController.java
@RequestMapping(value = "/rest/getUser.json", method = RequestMethod.GET) public @ResponseBody User getUser(Principal user) { return notesDao.getUser(user.getName(), Keys.email, Keys.display_name, Keys.first_name, Keys.last_name, Keys.image_url, Keys.isFbPostEnabled, Keys.prefs); }
From source file:com.ushahidi.swiftriver.core.api.controller.FormsController.java
/** * Handler for retrieving a specific Form * //from ww w.j ava 2 s . c o m * @param id * @return * @throws NotFoundException */ @RequestMapping(value = "/{id}", method = RequestMethod.GET) @ResponseBody public GetFormDTO getForm(@PathVariable Long id, Principal principal) throws NotFoundException { return formService.getForm(id, principal.getName()); }
From source file:org.mitreid.multiparty.service.InMemoryResourceService.java
@Override public void addResource(Resource res, Principal p) { if (p == null) { throw new IllegalArgumentException("Principal can't be null"); }/* w w w . ja va 2 s .c om*/ resources.put(p.getName(), res); }
From source file:top.zhacker.passport.client.showcase.HomeController.java
@RequestMapping("/") public String home(Principal currentUser, Model model) { model.addAttribute("connectionsToProviders", getConnectionRepository().findAllConnections()); if (currentUser != null) { model.addAttribute(accountRepository.findAccountByUsername(currentUser.getName())); }/*from w ww . ja va2 s . c o m*/ return "home"; }
From source file:alfio.controller.api.admin.AdminReservationApiController.java
@RequestMapping(value = "/event/{eventName}/{reservationId}/ticket/{ticketId}", method = RequestMethod.GET) public Result<Ticket> loadTicket(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, @PathVariable("ticketId") int ticketId, Principal principal) { return adminReservationManager.loadReservation(eventName, reservationId, principal.getName()) .flatMap(triple -> {/* ww w .ja v a2 s . c o m*/ //not optimal return triple.getMiddle().stream().filter(t -> t.getId() == ticketId).findFirst() .map(Result::success).orElse(Result.error(ErrorCode.custom("not_found", "not found"))); }); }
From source file:fr.exanpe.t5.lib.internal.authorize.AuthorizePageFilter.java
private String getUsername() { Principal p = requestGlobals.getHTTPServletRequest().getUserPrincipal(); if (p == null) { return "-"; }//from w w w . j ava2 s . co m return p.getName(); }
From source file:eu.scidipes.toolkits.pawebapp.web.RegistryAuthController.java
@RequestMapping(value = "/registries/setregcreds", method = RequestMethod.POST) @ResponseBody// w w w. ja v a2s. co m public Boolean setRegistryCredentials(@RequestParam final String regUID, @RequestParam final String regPrincipal, @RequestParam final String regCred, final Principal user) { final RegistryAuth registryAuth = new RegistryAuth(regUID, textEncryptor.encrypt(regPrincipal), textEncryptor.encrypt(regCred), user.getName()); regAuthRepo.saveAndFlush(registryAuth); return Boolean.TRUE; }