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}", method = RequestMethod.POST) public Result<Boolean> updateReservation(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, @RequestBody AdminReservationModification arm, Principal principal) { return adminReservationManager.updateReservation(eventName, reservationId, arm, principal.getName()); }
From source file:alfio.controller.api.admin.ConfigurationApiController.java
@RequestMapping(value = "/configuration/organization/{organizationId}/key/{key}", method = DELETE) public boolean deleteOrganizationLevelKey(@PathVariable("organizationId") int organizationId, @PathVariable("key") ConfigurationKeys key, Principal principal) { configurationManager.deleteOrganizationLevelByKey(key.getValue(), organizationId, principal.getName()); return true;//from w w w . ja v a2s . c o m }
From source file:alfio.controller.api.admin.UsersApiController.java
@RequestMapping(value = "/roles", method = GET) public Collection<RoleDescriptor> getAllRoles(Principal principal) { return userManager.getAvailableRoles(principal.getName()).stream().map(RoleDescriptor::new) .collect(Collectors.toList()); }
From source file:com.duroty.application.files.actions.DownloadFileAction.java
/** * DOCUMENT ME!/*from w ww .j a va 2s . c om*/ * * @param request DOCUMENT ME! * * @return DOCUMENT ME! */ protected Hashtable getContextProperties(HttpServletRequest request) { Hashtable props = (Hashtable) SessionManager.getObject(Constants.CONTEXT_PROPERTIES, request); if (props == null) { props = new Hashtable(); props.put(Context.INITIAL_CONTEXT_FACTORY, Configuration.properties.getProperty(Configuration.JNDI_INITIAL_CONTEXT_FACTORY)); props.put(Context.URL_PKG_PREFIXES, Configuration.properties.getProperty(Configuration.JNDI_URL_PKG_PREFIXES)); props.put(Context.PROVIDER_URL, Configuration.properties.getProperty(Configuration.JNDI_PROVIDER_URL)); Principal principal = request.getUserPrincipal(); props.put(Context.SECURITY_PRINCIPAL, principal.getName()); props.put(Context.SECURITY_CREDENTIALS, SessionManager.getObject(Constants.JAAS_PASSWORD, request)); props.put(Context.SECURITY_PROTOCOL, Configuration.properties.getProperty(Configuration.SECURITY_PROTOCOL)); SessionManager.setObject(Constants.CONTEXT_PROPERTIES, props, request); } return props; }
From source file:alfio.controller.api.admin.ConfigurationApiController.java
@RequestMapping(value = "/configuration/event/{eventId}/category/{categoryId}/key/{key}", method = DELETE) public boolean deleteCategoryLevelKey(@PathVariable("eventId") int eventId, @PathVariable("categoryId") int categoryId, @PathVariable("key") ConfigurationKeys key, Principal principal) { configurationManager.deleteCategoryLevelByKey(key.getValue(), eventId, categoryId, principal.getName()); return true;// w w w .j a va 2 s.c o m }
From source file:alfio.controller.api.admin.AdminReservationApiController.java
@RequestMapping(value = "/event/{eventName}/{reservationId}/cancel", method = RequestMethod.POST) public Result<Boolean> removeReservation(@PathVariable("eventName") String eventName, @PathVariable("reservationId") String reservationId, @RequestParam("refund") boolean refund, @RequestParam(value = "notify", defaultValue = "false") boolean notify, Principal principal) { adminReservationManager.removeReservation(eventName, reservationId, refund, notify, principal.getName()); return Result.success(true); }
From source file:runtheshow.resource.metiers.SousEvenenementMetier.java
@Override public Boolean addSousEvent(Principal user, SousEvenement sousEvent) { Evenement event = eventRepository/*w ww. j av a 2 s. co m*/ .findTop1ByCreateurOrderByIdDesc(userRepository.findUserByLogin(user.getName())); /*if(deb.length>0) { for(int i=0; i<deb.length; i++) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm"); try { Date dateDeb = sdf.parse(deb[i]); Date dateFin = sdf.parse(fin[i]); Calendar calendarDeb = Calendar.getInstance(); calendarDeb.setTime(dateDeb); Calendar calendarFin = Calendar.getInstance(); calendarFin.setTime(dateFin); SousEvenement sousEventPersit = new SousEvenement(calendarDeb, calendarFin, intitule[i], Integer.parseInt(etage[i]), event); return sousEventRepository.save(sousEventPersit) != null; } catch(Exception e) { System.out.println("Problme dans conversion date de [SousEventMetier : addSousEvent] " + e); } } }*/ SousEvenement sousEventPersist = new SousEvenement(sousEvent.getDateDebut(), sousEvent.getDateFin(), sousEvent.getIntitule(), sousEvent.getEtage(), event); sousEvent = sousEventRepository.save(sousEventPersist); return sousEvent != null; }
From source file:alfio.controller.api.admin.UsersApiController.java
@RequestMapping(value = "/organizations", method = GET) @ResponseStatus(HttpStatus.OK)/*from ww w . j a v a 2 s .c om*/ public List<Organization> getAllOrganizations(Principal principal) { return userManager.findUserOrganizations(principal.getName()); }
From source file:com.epam.ta.reportportal.ws.controller.impl.ExternalSystemController.java
@Override @RequestMapping(value = "/{systemId}/connect", method = RequestMethod.PUT, consumes = { APPLICATION_JSON_VALUE })/*from w w w.jav a 2 s .c o m*/ @ResponseBody @ResponseStatus(HttpStatus.OK) @PreAuthorize(PROJECT_LEAD) @ApiOperation("Check connection to external system instance") public OperationCompletionRS jiraConnection(@PathVariable String projectName, @PathVariable String systemId, @RequestBody @Validated UpdateExternalSystemRQ updateRQ, Principal principal) { return updateExternalSystemHandler.externalSystemConnect(systemId, updateRQ, principal.getName()); }
From source file:gateway.controller.util.GatewayUtil.java
/** * Safely returns the name of the user who has performed a request to a Gateway endpoint. * /* ww w.ja va 2 s. c o m*/ * @param user * The principal * @return The username. If the request was not authenticated, then that will be returned. */ public String getPrincipalName(Principal user) { return user != null ? user.getName() : "UNAUTHENTICATED"; }