List of usage examples for java.security Principal getName
public String getName();
From source file:com.laishidua.mobilecloud.ghostmyselfie.controller.GhostMySelfieController.java
/** * /*from w ww . j a v a 2 s. co m*/ * Serves the Selfie list from a user, leaving the heavy lifting to Spring. * * @return ...the ghostmyselfie list, of course! */ @RequestMapping(value = GhostMySelfieSvcApi.GHOSTMYSELFIE_SVC_PATH, method = RequestMethod.GET) public @ResponseBody List<GhostMySelfie> getGhostMySelfieList(Principal p) { return Lists.newArrayList(ghostMySelphie.findByOwner(p.getName())); }
From source file:alfio.controller.api.SpecialPriceApiController.java
@RequestMapping("/events/{eventName}/categories/{categoryId}/send-codes") 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 ww. j a v a 2s. co m*/ }
From source file:net.sourceforge.safr.jaas.permission.PermissionManagerImpl.java
public Collection<InstancePermission> getPermissions(Principal principal) { return Collections.unmodifiableList(getPermissionMap(principal).getEager(principal.getName())); }
From source file:com.epam.ta.reportportal.ws.controller.impl.ProjectController.java
@Override @PreAuthorize(ADMIN_ONLY)//from w w w . j a va 2s. co m @RequestMapping(method = POST) @ResponseBody @ResponseStatus(CREATED) @ApiOperation("Create new project") public EntryCreatedRS createProject(@RequestBody @Validated CreateProjectRQ createProjectRQ, Principal principal) { return createProjectHandler.createProject(createProjectRQ, principal.getName()); }
From source file:org.geosdi.geoplatform.experimental.dropwizard.resources.secure.folder.GPSecureFolderResource.java
@GET @Path(value = GPServiceRSPathConfig.GET_CHILDREN_FOLDERS_PATH) @Override//from ww w. j a va 2s. co m public ChildrenFolderStore getChildrenFolders(@Auth Principal principal, @PathParam(value = "folderID") Long folderID) { logger.debug("\n\n@@@@@@@@@@@@@@@@@Executing secure getChildrenFolders " + "- Principal : {}\n\n", principal.getName()); return super.getChildrenFolders(folderID); }
From source file:org.geosdi.geoplatform.experimental.dropwizard.resources.secure.viewport.GPSecureViewportResource.java
@GET @Path(value = GPServiceRSPathConfig.GET_ACCOUNT_PROJECT_VIEWPORTS_PATH) @Override// w w w .ja v a2s . c o m public WSGetViewportResponse getAccountProjectViewports(@Auth Principal principal, @PathParam(value = "accountProjectID") Long accountProjectID) throws Exception { logger.debug("\n\n@@@@@@@@@@@@@@Executing secure" + " getAccountProjectViewports - Principal : {}\n\n", principal.getName()); return super.getAccountProjectViewports(accountProjectID); }
From source file:org.geosdi.geoplatform.experimental.dropwizard.resources.secure.folder.GPSecureFolderResource.java
@GET @Path(value = GPServiceRSPathConfig.GET_CHILDREN_ELEMENTS_PATH) @Override// www. ja v a2 s. com public TreeFolderElementsStore getChildrenElements(@Auth Principal principal, @PathParam(value = "folderID") Long folderID) { logger.debug("\n\n@@@@@@@@@@@@@@@@@Executing secure getChildrenElements " + "- Principal : {}\n\n", principal.getName()); return super.getChildrenElements(folderID); }
From source file:be.fedict.hsm.admin.webapp.security.AuthenticationController.java
public void login(ComponentSystemEvent event) { LOG.debug("login"); FacesContext facesContext = FacesContext.getCurrentInstance(); if (facesContext.getResponseComplete()) { return;/*w w w . j a va2s . c o m*/ } if (null == this.authenticationCertificate) { /* * Caused by a direct navigation to post-login.jsf */ redirect(facesContext, "/index.xhtml"); return; } byte[] encodedCertificate; try { encodedCertificate = this.authenticationCertificate.getEncoded(); } catch (CertificateEncodingException e) { LOG.error("certificate encoding error: " + e.getMessage(), e); return; } /* * The challenged certificate is the unique user identifier. */ String username = DigestUtils.sha1Hex(encodedCertificate); String password = this.identity.getCardNumber(); ExternalContext externalContext = facesContext.getExternalContext(); HttpServletRequest httpServletRequest = (HttpServletRequest) externalContext.getRequest(); try { httpServletRequest.login(username, password); } catch (ServletException e) { LOG.error("login error: " + e.getMessage(), e); accessDenied(facesContext); return; } Principal userPrincipal = httpServletRequest.getUserPrincipal(); if (null == userPrincipal) { accessDenied(facesContext); return; } LOG.debug("user principal: " + userPrincipal.getName()); LOG.debug("admin role: " + httpServletRequest.isUserInRole(AdministratorRoles.ADMINISTRATOR)); if (false == httpServletRequest.isUserInRole(AdministratorRoles.ADMINISTRATOR)) { accessDenied(facesContext); return; } String targetViewId = SecurityPhaseListener.getTargetViewId(externalContext); redirect(facesContext, targetViewId); }
From source file:org.geosdi.geoplatform.experimental.dropwizard.resources.secure.message.GPSecureMessageResource.java
@GET @Path(value = GPServiceRSPathConfig.GET_UNREAD_MESSAGES_BY_RECIPIENT_PATH) @Override/*from w w w. j a v a 2 s. c o m*/ public GetMessageResponse getUnreadMessagesByRecipient(@Auth Principal principal, @PathParam(value = "recipientID") Long recipientID) throws Exception { logger.debug("\n\n@@@@@@@@@@@@@@Executing secure " + "getUnreadMessagesByRecipient - Principal : {}\n\n", principal.getName()); return super.getUnreadMessagesByRecipient(recipientID); }