List of usage examples for java.security Principal getName
public String getName();
From source file:ch.rasc.s4ws.portfolio.web.PortfolioController.java
@SubscribeMapping("/positions") public List<PortfolioPosition> getPositions(Principal principal) throws Exception { logger.debug("Positions for " + principal.getName()); Portfolio portfolio = this.portfolioService.findPortfolio(principal.getName()); return portfolio.getPositions(); }
From source file:com.springsource.oauthservice.develop.AppController.java
@RequestMapping(value = "/apps", method = RequestMethod.GET) public List<AppSummary> list(Principal user) { return appRepository.findAppSummaries(user.getName()); }
From source file:com.example.ClientDetailsController.java
@GetMapping("/clients") public String clients(Map<String, Object> model, Principal user) { model.put("user", user.getName()); List<ClientDetails> details = new ArrayList<>(); List<Map<String, Object>> list = template.queryForList("SELECT * from user_client_details where username=?", user.getName());/* w w w . java2 s . co m*/ for (ClientDetails clientDetails : clients.listClientDetails()) { if (isOwner(user.getName(), clientDetails.getClientId(), list)) { details.add(clientDetails); } } model.put("clients", details); return "clients"; }
From source file:org.hdiv.logs.UserData.java
public String getUsername(HttpServletRequest request) { // Find username in JEE standard security Principal principal = request.getUserPrincipal(); if (principal != null && principal.getName() != null) { return principal.getName(); }/* w ww .j a va 2 s .co m*/ // Find username in Spring Security if (springSecurityPresent) { SecurityContext securityContext = SecurityContextHolder.getContext(); if (securityContext != null && securityContext.getAuthentication() != null) { return securityContext.getAuthentication().getName(); } } // Return anonymous return IUserData.ANONYMOUS; }
From source file:com.redblackit.web.controller.SecurityController.java
/** * Access denied handling.//from w w w . j a va2 s . c o m * * For now we log, then fire up the login page with an appropriate message parameter * * @param principal * @param model */ @RequestMapping("/accessDenied") @ResponseStatus(value = HttpStatus.FORBIDDEN) public String accessDenied(Principal principal, Model model) { logger.error("access denied to " + principal.getName()); model.addAttribute("login_error", "login.access.denied"); return "login"; }
From source file:fm.push.web.PortfolioController.java
@CrossOrigin @SubscribeMapping("/positions") public List<PortfolioPosition> getPositions(Principal principal) throws Exception { logger.debug("Positions for " + principal.getName()); Portfolio portfolio = this.portfolioService.findPortfolio(principal.getName()); return portfolio.getPositions(); }
From source file:com.orange.clara.cloud.services.sandbox.application.SandboxService.java
public SandboxInfo createSandbox(Principal principal) { Validate.notNull(principal);//from w w w . ja va 2 s .co m LOGGER.info("Create sandbox for {}", principal.getName()); UserInfo userInfo = identityService.getInfo(principal); return privateSandboxService.createSandboxForUser(userInfo); }
From source file:cz.muni.pa165.carparkapp.web.PersonalInfoController.java
@RequestMapping(method = RequestMethod.GET) public String getEmployee(Model model, Principal principal) { String userName = principal.getName();//(String)SecurityContextHolder.getContext().getAuthentication().getPrincipal(); EmployeeDTO result = null;//from ww w .j ava 2s.c o m for (EmployeeDTO e : employeeService.getAllEmployees()) { if (e.getUserName().equals(userName)) result = e; } log.debug("getEmployee()"); model.addAttribute("empl", employeeService.findEmployeeById(result.getId())); return "employee"; }
From source file:org.ng200.openolympus.controller.user.UserInfoController.java
@RequestMapping(method = RequestMethod.GET) public String showUserDetailsForm(Model model, final UserInfoDto userInfoDto, Principal principal) { super.initialiseDTO(userInfoDto, userRepository.findByUsername(principal.getName())); model.addAttribute("postUrl", "/user"); model.addAttribute("changePasswordLink", "/user/changePassword"); return "user/personalInfo"; }
From source file:mx.gob.cfe.documentos.web.UsuarioController.java
@RequestMapping("/nuevo") public String nuevo(Model model, Principal principal) { String name = principal.getName(); Usuario usuario = instance.obtinePorUsername(name); if (!usuario.isAdministrador()) { return "usuario/noAutorizado"; }/* w w w . ja v a 2 s .c o m*/ model.addAttribute("usuario", new Usuario()); return "usuario/nuevo"; }