public Map<String, String> getUserAttributeMap(Subject subject, Collection<UserAttributeRef> userAttributeRefs, RequestContext context) { Map<String,String> userAttributeMap = new HashMap<String,String>(); Principal userPrincipal = SubjectHelper.getPrincipal(subject, User.class); if (null != userPrincipal) { log.debug("Got user principal: " + userPrincipal.getName()); Map<String, String> userInfo = ((User)userPrincipal).getInfoMap(); if (userAttributeRefs != null) { for (UserAttributeRef currentAttributeRef : userAttributeRefs) { String key = currentAttributeRef.getNameLink(); String name = currentAttributeRef.getName(); if (key == null) { key = name; } if (userInfo.containsKey(key)) { userAttributeMap.put(name, userInfo.get(key)); } } } } return userAttributeMap; } }
for (UserAttributeRef currentAttributeRef : userAttributeRefs) if ((currentAttribute.getName()).equals(currentAttributeRef.getNameLink())) impl.setNameLink(currentAttributeRef.getNameLink()); linkedAttribute = true; break;