for (Entry e : groupSearch) { if (LOG.isTraceEnabled()) { LOG.trace("Group Entry: {}", e.toString(" ")); if (! e.containsAttribute(groupIdAttribute)) { LOG.warn("Unknown group id attribute {}, skipping group entry {}", groupIdAttribute, e); continue; final String groupId = e.get(groupIdAttribute).getString(); if (ldapEntry == null) { if (e.hasObjectClass("groupOfUniqueNames")) { memberAttribute = ATTRIBUTE_UNIQUE_MEMBER; } else if (e.hasObjectClass("groupOfNames") || e.hasObjectClass("group")) { memberAttribute = ATTRIBUTE_MEMBER; } else if (e.hasObjectClass("posixGroup")) { memberAttribute = ATTRIBUTE_MEMBER_UID; } else { if (e.containsAttribute(ATTRIBUTE_UNIQUE_MEMBER)) { memberAttribute = ATTRIBUTE_UNIQUE_MEMBER; } else if (e.containsAttribute(ATTRIBUTE_MEMBER_UID)) { memberAttribute = ATTRIBUTE_MEMBER_UID; } else { final Attribute members = e.get(memberAttribute); if (members != null) { final String dn = normalizedDn(ldapEntry.getDn());
final Entry e = it.next(); ldapEntry.setDn(e.getDn().getName()); ldapEntry.setBindPrincipal(e.getDn().getName()); for (Attribute attribute : e.getAttributes()) { if (activeDirectory && "userPrincipalName".equalsIgnoreCase(attribute.getId())) { ldapEntry.setBindPrincipal(attribute.getString()); if (attribute.isHumanReadable()) { ldapEntry.put(attribute.getId(), Joiner.on(", ").join(attribute.iterator())); if ("memberOf".equalsIgnoreCase(attribute.getId()) || "isMemberOf".equalsIgnoreCase(attribute.getId())) { for (Value<?> group : attribute) { groupDns.add(group.getString()); final Attribute groupId = group.get(groupIdAttribute); LOG.trace("Resolved {} to group {}", groupDn, groupId); if (groupId != null) { final String string = groupId.getString(); ldapEntry.addGroups(Collections.singleton(string));
public Entry toClientEntry() throws LdapException { // Copy the Dn Entry clientEntry = new DefaultEntry( clonedEntry.getDn() ); // Convert each attribute for ( Attribute clonedEntry : this ) { Attribute clientAttribute = clonedEntry.clone(); clientEntry.add( clientAttribute ); } return clientEntry; }
/** * {@inheritDoc} */ @Override public Attribute get( AttributeType attributeType ) { return entry.get( attributeType ); }
/** * {@inheritDoc} */ @Override public boolean contains( Attribute... attributes ) { return entry.contains( attributes ); }
/** * {@inheritDoc} */ @Override public boolean hasObjectClass( Attribute... objectClasses ) { return entry.hasObjectClass( objectClasses ); }
/** * Create a new instance of an Attribute, without value. * @param upId The user provided ID */ public DefaultAttribute( String upId ) { setUpId( upId ); }
/** * {@inheritDoc} */ @Override public Attribute put( AttributeType attributeType, String... values ) throws LdapException { return put( null, attributeType, values ); }
/** * {@inheritDoc} */ public boolean contains( AttributeType attributeType, byte[]... values ) { return entry.contains( attributeType, values ); }
/** * Create a new instance of an Attribute, without value. * @param upId The user provided ID */ public DefaultAttribute( byte[] upId ) { setUpId( upId ); }
/** * {@inheritDoc} */ @Override public Attribute put( AttributeType attributeType, Value... values ) throws LdapException { return put( null, attributeType, values ); }
groups.add(cursor.get().get(configuration.getGroupNameAttribute()).getString()); Optional<SingularityUser> result = Optional.of(new SingularityUser(user, com.google.common.base.Optional.fromNullable(Strings.emptyToNull(userEntry.get(configuration.getUserNameAttribute()).getString())), com.google.common.base.Optional.fromNullable(Strings.emptyToNull(userEntry.get(configuration.getUserEmailAttribute()).getString())), groups));
/** * Sets the User Provided ID as a byte[] * * @param upId The User Provided ID */ public void setUpId( byte[] upId ) { setUpId( upId, attributeType ); }