List of usage examples for java.security Principal getName
public String getName();
From source file:com.katropine.admin.controllers.SecurityNavigationController.java
@RequestMapping(value = "/success-login", method = RequestMethod.GET) public String successLogin(Model model, Principal principal) { // Principal principal String name = ""; name = principal.getName(); //get logged in username return "redirect:/admin/springmvc/greeting/" + name; }
From source file:com.springsource.oauthservice.develop.AppController.java
@RequestMapping(value = "/apps/edit/{slug}", method = RequestMethod.GET) public String editForm(@PathVariable String slug, Principal user, Model model) { model.addAttribute(appRepository.getAppForm(user.getName(), slug)); model.addAttribute("slug", slug); return "develop/apps/edit"; }
From source file:de.uni_koeln.spinfo.maalr.login.MaalrAuthorityGranter.java
public Set<String> grant(Principal principal) { HashSet<String> roles = new HashSet<String>(); String name = principal.getName(); if ("admin".equals(name)) { roles.add(Role.ADMIN_5.getRoleId()); return roles; }//www .j av a2 s. c o m MaalrUserInfo user = userInfos.getByLogin(name); if (user == null) { user = new MaalrUserInfo(name, Role.GUEST_1); try { userInfos.insert(user); } catch (InvalidUserException e) { throw new RuntimeException(e); } roles.add(user.getRole().getRoleId()); return roles; } roles.add(user.getRole().getRoleId()); return roles; }
From source file:sample.mvc.RestDemoController.java
@RequestMapping(value = "/", produces = "application/json") public Map<String, String> helloUser(Principal principal) { HashMap<String, String> result = new HashMap<String, String>(); result.put("username", principal.getName()); return result; }
From source file:com.orange.clara.cloud.services.sandbox.infrastructure.CloudfoundryIdentityService.java
@Override public UserInfo getInfo(Principal userPrincipal) { createUserInCloudfoundry();// w w w .ja va2 s . c o m String username = userPrincipal.getName(); LOGGER.info("User {} has been created on cloudfoundry.", username); String userGuid = getUserGuidFromAccessToken(username); return new UserInfo(username, userGuid); }
From source file:com.springsource.oauthservice.develop.AppController.java
@RequestMapping(value = "/apps/{slug}", method = RequestMethod.GET) public String view(@PathVariable String slug, Principal user, Model model) { model.addAttribute(appRepository.findAppBySlug(user.getName(), slug)); model.addAttribute("slug", slug); return "develop/apps/view"; }
From source file:com.capstone.giveout.controllers.UsersController.java
@PreAuthorize("hasRole(mobile)") @RequestMapping(value = Routes.CURRENT_USER_PATH, method = RequestMethod.GET) public @ResponseBody User getCurrent(Principal p) { return users.findByUsername(p.getName()); }
From source file:mx.gob.cfe.documentos.web.FeligresController.java
@RequestMapping public String lista(Model model, Principal principal) { String username = principal.getName(); Usuario usuario = usuarioDao.obtinePorUsername(username); model.addAttribute("feligreses", instance.lista()); List lista = instance.lista(); log.error("lista{}", lista); return "feligres/lista"; }
From source file:org.mitre.oauth2.web.AccessTokenAPI.java
@RequestMapping(value = "", method = RequestMethod.GET, produces = "application/json") public String getAll(ModelMap m, Principal p) { Set<OAuth2AccessTokenEntity> allTokens = tokenService.getAllAccessTokensForUser(p.getName()); m.put("entity", allTokens); return "jsonEntityView"; }
From source file:it.greenvulcano.gvesb.api.security.JaxRsIdentityInfo.java
@Override public String getName() { Principal p = securityContext.getUserPrincipal(); return (p != null ? p.getName() : "NONE"); }