public UserDetailBean(User user, PasswordCredential credential, List<Role> roles, List<Group> groups, List<String> allRoles, List<String> allGroups, String rule, List<String> profilingRules) { this.name = user.getName(); this.infoMap = user.getInfoMap(); this.creationDate = user.getCreationDate(); this.modifiedDate = user.getModifiedDate(); this.enabled = user.isEnabled(); this.availableRoles = allRoles; this.availableGroups = allGroups; this.availableRules = profilingRules; this.rule = rule; this.credentialUpdateRequired = credential.isUpdateRequired(); for (Role role : roles) { this.roles = (this.roles == null ? new ArrayList<String>() : this.roles); this.roles.add(role.getName()); if (availableRoles.contains(role.getName())) { availableRoles.remove(role.getName()); } } for (Group group : groups) { this.groups = (this.groups == null ? new ArrayList<String>() : this.groups); this.groups.add(group.getName()); if (availableGroups.contains(group.getName())) { availableGroups.remove(group.getName()); } } }
public String getName() { return user.getName(); } public User getUser()
log.debug("OpenID login registered portal user: "+portalUser.getName()+", configuration: "+logConfiguration+", locale: "+loginLocale+", server: "+loginServerName); SecurityAttributes portalUserAttributes = portalUser.getSecurityAttributes(); for (Map.Entry<String,String> attribute : userAttributes.entrySet()) throw new RuntimeException("Unable to update attributes for user: "+portalUser.getName()); throw new RuntimeException("Unable to login portal user: "+portalUser.getName()); portalUserContentCacheManager.evictUserContentCache(portalUser.getName(), httpSession.getId()); portalAudit.logUserActivity(portalUser.getName(), request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "OpenIDRelayingPartyServlet");
user.getSecurityAttributes().getAttribute("user.name.given", true).setStringValue(userNameGiven); user.getSecurityAttributes().getAttribute("user.name.family", true).setStringValue(userNameFamily); user.getSecurityAttributes().getAttribute("user.business-info.online.email", true).setStringValue(userEmail); user.setEnabled(userEnabled); List<Role> currentRoles = roleManager.getRolesForUser(user.getName()); for (Role currentRole : currentRoles) List<Group> currentGroups = groupManager.getGroupsForUser(user.getName());
user.getSecurityAttributes().getAttribute("user.name.given", true).setStringValue(userNameGiven); user.getSecurityAttributes().getAttribute("user.name.family", true).setStringValue(userNameFamily); user.getSecurityAttributes().getAttribute("user.business-info.online.email", true).setStringValue(userEmail);
/** * Helper method to get the user information of an user as Map. * * @param username Name of the user of request * @return Map containing the user information keyed by the name of the attribute. * @throws SecurityException */ private Map<String, String> getUserInfo(String username) throws SecurityException { User user = userManager.getUser(username); if(user != null) { return user.getInfoMap(); } return new HashMap<String, String>(); }
public void resolve(User user, Set<Long> resolvedIds, Set<Principal> principals, Map<String, UserSubjectPrincipalsResolver> resolvers) { checkInitialized(); if (user.getId() == null || !user.isEnabled()) { // sanity check return; } List<JetspeedPrincipal> found = null; if (fromUser) { found = accessManager.getAssociatedFrom(user.getId(), uat.getFromPrincipalType(), uat.getToPrincipalType(), uat.getAssociationName()); } else { found = accessManager.getAssociatedTo(user.getId(), uat.getFromPrincipalType(), uat.getToPrincipalType(), uat.getAssociationName()); } processFound(found, user, resolvedIds, principals, resolvers); }
@SuppressWarnings("unchecked") public List<PasswordCredential> getHistoricPasswordCredentials(User user, Long securityDomain) { Criteria criteria = new Criteria(); criteria.addEqualTo("principalId", user.getId()); criteria.addEqualTo("type", PasswordCredential.TYPE_HISTORICAL); // check cache String cacheKey = "getHistoricPasswordCredentials:"+criteria; List<PasswordCredential> passwordCredentials = (List<PasswordCredential>) jspmCache.getPasswordCredentialQuery(cacheKey); if (passwordCredentials != null) { return new ArrayList<PasswordCredential>(passwordCredentials); } // perform query Query query = QueryFactory.newQuery(PasswordCredentialImpl.class,criteria); passwordCredentials = (List<PasswordCredential>)getPersistenceBrokerTemplate().execute(new ManagedListByQueryCallback(query)); for (PasswordCredential passwordCredential : passwordCredentials) { // store the user by hand as its configured as auto-retrieve="false" ((PasswordCredentialImpl)passwordCredential).setUser(user); } // put result in cache jspmCache.putPasswordCredentialQuery(cacheKey, user.getId(), user.getDomainId(), new ArrayList<PasswordCredential>(passwordCredentials)); // return result return passwordCredentials; }
public String getUserName() { return user.getName(); } }
SecurityAttributes secAttrs = user.getSecurityAttributes(); SecurityAttribute secAtttr = secAttrs.getAttribute(PortalReservedParameters.USER_HOMEPAGE_REFRESH_FLAG); String userName = user.getName(); String userFolder = Folder.USER_FOLDER + userName;
SecurityAttribute attrib = user.getSecurityAttributes().getAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE); if (attrib != null)
public Map<String,String> getUserAttributes(RequestContext rc) { Map<String,String> map = null; Principal principal = rc.getRequest().getUserPrincipal(); if (principal instanceof UserSubjectPrincipal) { UserSubjectPrincipal jp = (UserSubjectPrincipal)principal; map = jp.getUser().getInfoMap(); } return map; }
public void processPrincipal(JetspeedPrincipal principal, User user, Set<Long> resolvedIds, Set<Principal> principals, Map<String, UserSubjectPrincipalsResolver> resolvers) { checkInitialized(); if (user.getId() == null || !user.isEnabled() || principal.getId() == null || !principal.isEnabled() || principal.getType() != principalType) { // sanity check return; } principals.add(principal); if (iatList != null) { for (JetspeedPrincipalAssociationType iat : iatList) { List <JetspeedPrincipal> found = null; if ((!iat.isMixedTypes() && !iat.isSingular()) || !iat.getFromPrincipalType().getName().equals(getPrincipalType().getName())) { found = accessManager.getAssociatedTo(principal.getId(), iat.getFromPrincipalType(), iat.getToPrincipalType(), iat.getAssociationName()); } else { found = accessManager.getAssociatedFrom(principal.getId(), iat.getFromPrincipalType(), iat.getToPrincipalType(), iat.getAssociationName()); } processFound(found, user, resolvedIds, principals, resolvers); } } } }
public PasswordCredential getPasswordCredential(User user) criteria.addEqualTo("principalId", user.getId()); criteria.addEqualTo("type", PasswordCredential.TYPE_CURRENT); jspmCache.putPasswordCredentialQuery(cacheKey, user.getId(), user.getDomainId(), passwordCredential);
if (credential.getUser() == null || !credential.getUser().isEnabled())
/** * @return The username. */ public String getUserName() { return user != null ? user.getName() : userName; }
SecurityAttributes userAttrs = user.getSecurityAttributes(); for (Map.Entry<String, String> entry : userInfo.entrySet()) { userAttrs.getAttribute(entry.getKey(), true).setStringValue(entry.getValue());
public Map<String,String> getUserAttributes() { RequestContext rc = getRequestContext(); Map<String,String> map = null; Principal principal = rc.getRequest().getUserPrincipal(); if (principal instanceof UserSubjectPrincipal) { UserSubjectPrincipal jp = (UserSubjectPrincipal)principal; map = jp.getUser().getInfoMap(); } return map; }