public boolean inGroup(String name, String groupType) { for (Group group : activeGroups) { if (group.getName().equals(name) && group.getGroupType().equals(groupType)) return true; } return false; }
protected IdentityObject createIdentityObject(Group group) { IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(group.getGroupType()); return new SimpleIdentityObject(group.getName(), group.getKey(), iot); }
public void putGroup(String ns, Group group) { Fqn nodeFqn = getFqn(ns, NODE_GROUPS, group.getKey()); Node ioNode = addNode(nodeFqn); if (ioNode != null) { ioNode.put(NODE_OBJECT_KEY, group); if (log.isLoggable(Level.FINER)) { log.finer(this.toString() + "Group stored in cache: " + group.getKey() + ";namespace=" + ns); } } }
String cachedId = getIntegrationCache().getGtnGroupId(getCacheNS(), jbidGroup.getKey()); if (cachedId != null) { return cachedId; getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId); String gtnGroupName = getGtnGroupName(jbidGroup.getName()); log.info("PLIDM Group has more than one parent: " + jbidGroup.getName() + "; Will try to use parent path " + "defined by type mappings or just place it under root /"); getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId); getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId); getIntegrationCache().putGtnGroupId(getCacheNS(), jbidGroup.getKey(), calculatedId);
public int compare(T o1, T o2) { if (o1 instanceof User && o2 instanceof User) { if (ascending) { return o1.getKey().compareTo(o2.getKey()); } else { return o2.getKey().compareTo(o1.getKey()); } } else { Group g1 = (Group)o1; Group g2 = (Group)o2; if (ascending) { return g1.getName().compareTo(g2.getName()); } else { return g2.getName().compareTo(g1.getName()); } } } });
/** * Obtain group id based on groupType mapping from configuration or if this fails just place it under root / * * @param jbidGroup * @param gtnGroupName * @return */ private String obtainMappedId(org.picketlink.idm.api.Group jbidGroup, String gtnGroupName) { String id = orgService.getConfiguration().getParentId(jbidGroup.getGroupType()); if (id != null && orgService.getConfiguration().isForceMembershipOfMappedTypes()) { if (id.endsWith("/*")) { id = id.substring(0, id.length() - 2); } return id + "/" + gtnGroupName; } // All groups not connected to the root should be just below the root return "/" + gtnGroupName; // TODO: make it configurable // throw new IllegalStateException("Group present that is not connected to the root: " + jbidGroup.getName()); }
public Group getGroup(String ns, String groupType, String groupName) { Fqn nodeFqn = getFqn(ns, NODE_GROUPS, GroupKey.parseKey(groupName, groupType)); Node node = getNode(nodeFqn); if (node != null) { Group group = (Group)node.get(NODE_OBJECT_KEY); if (log.isLoggable(Level.FINER) && group != null) { log.finer(this.toString() + "Group found in cache: id=" + group.getKey() + ";namespace=" + ns); } return group; } return null; }
private static void filterByIdFilter(List<? extends IdentityType> types, String filter) throws Exception { Set<IdentityType> toRemove = new HashSet<IdentityType>(); String regex = Tools.wildcardToRegex(filter); for (IdentityType type : types) { String id = null; if (type instanceof User) { id = type.getKey(); } else if (type instanceof Group) { id = ((Group)type).getName(); } else { // shouldn't happen throw new IllegalStateException(); } if (!id.matches(regex)) { toRemove.add(type); } } for (IdentityType type : toRemove) { types.remove(type); } }
public void removeGroup(String name, String groupType) { for (Group group : activeGroups) { if (group.getName().equals(name) && group.getGroupType().equals(groupType)) { activeGroups.remove(group); return; } } }
public Collection<User> findUsersWithRelatedRole(Group group, IdentitySearchCriteria criteria) throws IdentityException { checkNotNullArgument(group, "Group"); List<User> identities = new LinkedList<User>(); if (cache != null) { UserSearchImpl search = new UserSearchImpl(); search.addRelatedGroupId(group.getKey()); search.setSearchCriteria(criteria); Collection<User> results = cache.getUserSearch(cacheNS, search); if (results != null) { return results; } } Collection<IdentityObject> ios = null; ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), ROLE, true, convertSearchControls(criteria)); for (IdentityObject io : ios) { identities.add(createUser(io)); } if (cache != null) { UserSearchImpl search = new UserSearchImpl(); search.addRelatedGroupId(group.getKey()); search.setSearchCriteria(criteria); cache.putUserSearch(cacheNS, search, identities); } return identities; }
String gtnGroupName = getGtnGroupName(jbidGroup.getName());
public boolean hasRole(String roleType, String group, String groupType) { if (!securityEnabled) return true; if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true; tryLogin(); for (Role role : activeRoles) { if (role.getRoleType().getName().equals(roleType) && role.getGroup().getName().equals(group) && role.getGroup().getGroupType().equals(groupType)) { return true; } } return false; }
/** * Removes a role from the authenticated user * * @param role The name of the role to remove */ public void removeRole(String roleType, String group, String groupType) { for (Role role : activeRoles) { if (role.getRoleType().getName().equals(roleType) && role.getGroup().getName().equals(group) && role.getGroup().getGroupType().equals(groupType)) { activeRoles.remove(role); return; } } }
r.getGroup().getName(), r.getGroup().getGroupType())) { FactHandle fh = getSecurityContext().getFactHandle(r); getSecurityContext().retract(fh);
role.getGroup().getName(), role.getGroup().getGroupType());
getIdentitySession().getRelationshipManager().disassociateUsersByKeys(group.getKey(), keys); } catch (Exception e) {
for (Role role : identitySession.getRoleManager().findRoles(u, roleType)) { identity.addRole(role.getRoleType().getName(), role.getGroup().getName(), role.getGroup().getGroupType()); identity.addGroup(g.getName(), g.getGroupType());