List of usage examples for java.security Principal getName
public String getName();
From source file:alfio.controller.api.admin.AdminReservationApiController.java
@RequestMapping(value = "/event/{eventName}/{reservationId}/payment-info", method = RequestMethod.GET) public Result<TransactionAndPaymentInfo> getPaymentInfo(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, Principal principal) { return adminReservationManager.getPaymentInfo(eventName, reservationId, principal.getName()); }
From source file:de.fau.amos4.web.ClientController.java
@RequestMapping(value = "/client/dashboard") public ModelAndView ClientDashboard(Principal principal) { ModelAndView mav = new ModelAndView(); mav.setViewName("client/dashboard"); final String currentUser = principal.getName(); Client client = clientService.getClientByEmail(currentUser); Iterable<Employee> clientsEmployees = employeeRepository.findByClient(client); mav.addObject("Employees", clientsEmployees); return mav;// w w w . j a va2 s. co m }
From source file:alfio.controller.api.admin.AdminReservationApiController.java
@RequestMapping(value = "/event/{eventName}/new", method = RequestMethod.POST) public Result<String> createNew(@PathVariable("eventName") String eventName, @RequestBody AdminReservationModification reservation, Principal principal) { return adminReservationManager.createReservation(reservation, eventName, principal.getName()) .map(r -> r.getLeft().getId()); }
From source file:alfio.controller.api.admin.AdminReservationApiController.java
@RequestMapping(value = "/event/{eventName}/{reservationId}", method = RequestMethod.GET) public Result<TicketReservationDescriptor> loadReservation(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, Principal principal) { return adminReservationManager.loadReservation(eventName, reservationId, principal.getName()) .map(triple -> toReservationDescriptor(reservationId, triple)); }
From source file:alfio.controller.api.admin.UsersApiController.java
@RequestMapping(value = "/users/{id}/enable/{enable}", method = POST) public String enableUser(@PathVariable("id") int userId, @PathVariable("enable") boolean enable, Principal principal) { userManager.enable(userId, principal.getName(), enable); return OK;/*from w w w . j a v a 2 s . co m*/ }
From source file:com.notemyweb.controller.RestController.java
@RequestMapping(value = "/rest/getWeb.json", method = RequestMethod.GET) public @ResponseBody List<User> getWeb(Principal user) { return notesDao.getWeb(user.getName()); }
From source file:sample.U2fController.java
@RequestMapping(value = "/u2f/authenticate", method = RequestMethod.POST) public String authenticate(@RequestParam String tokenResponse, Principal principal) throws DeviceCompromisedException { AuthenticateResponse response = AuthenticateResponse.fromJson(tokenResponse); String username = principal.getName(); // Get the challenges that we stored when starting the authentication AuthenticateRequestData authenticateRequest = requestStorage.delete(response.getRequestId()); // Verify the that the given response is valid for one of the registered // devices//from w w w . j av a 2 s.c om u2f.finishAuthentication(authenticateRequest, response, getRegistrations(username)); return "u2f/success"; }
From source file:alfio.controller.api.admin.ConfigurationApiController.java
@RequestMapping(value = "/configuration/events/{eventId}/plugin/update-bulk", method = POST) public boolean updatePluginConfiguration(@PathVariable int eventId, @RequestBody List<PluginConfigOptionModification> input, Principal principal) { pluginManager.saveAllConfigOptions(eventId, Objects.requireNonNull(input), principal.getName()); return true;//from w w w. j av a2 s. co m }
From source file:sample.websocket.WebSocketConnectHandler.java
public void onApplicationEvent(SessionConnectEvent event) { MessageHeaders headers = event.getMessage().getHeaders(); Principal user = SimpMessageHeaderAccessor.getUser(headers); if (user == null) { return;/*w w w .j av a 2 s . c om*/ } String id = SimpMessageHeaderAccessor.getSessionId(headers); this.repository.save(new ActiveWebSocketUser(id, user.getName(), Calendar.getInstance())); this.messagingTemplate.convertAndSend("/topic/friends/signin", Arrays.asList(user.getName())); }
From source file:alfio.controller.api.admin.AdminReservationApiController.java
@RequestMapping(value = "/event/{eventName}/{reservationId}/confirm", method = RequestMethod.PUT) public Result<TicketReservationDescriptor> confirmReservation(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, Principal principal) { return adminReservationManager.confirmReservation(eventName, reservationId, principal.getName()) .map(triple -> toReservationDescriptor(reservationId, triple)); }