Package org.springframework.ldap.core

Examples of org.springframework.ldap.core.DistinguishedName


        return resultSet;
    }
   
    public Entity getEntityByInternalId(String internalId){
        Entity resultEntity = null;
        DistinguishedName principalDN = getRelativeDN(internalId);
        String relativeDN = principalDN.toCompactString();
        String searchDNStr = searchDN.toCompactString();
        if (relativeDN.equals(searchDNStr) || relativeDN.endsWith(searchDNStr)){
            internalId = principalDN.toCompactString();
           
            ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
            try
            {
                Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
View Full Code Here


    }

    public Entity getParentEntity(Entity childEntity)
    {
       
        DistinguishedName parentDN = new DistinguishedName(childEntity.getInternalId());
        parentDN.removeLast();
        return getEntityByInternalId(parentDN.encode());
    }
View Full Code Here

        return getEntityByInternalId(parentDN.encode());
    }

    protected DistinguishedName getRelativeDN(String fullDN)
    {
        DistinguishedName principalDN = new DistinguishedName(fullDN);
        if (configuration.getBaseDN() != null && configuration.getBaseDN().length() > 0)
        {
            principalDN.removeFirst(new DistinguishedName(configuration.getBaseDN()));
        }
        return principalDN;
    }
View Full Code Here

        ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
        try
        {
            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
            String parentId = parent.getInternalId();
            DistinguishedName parentDN = getRelativeDN(parentId);
            results = (Collection<Entity>) ldapTemplate.search(parentDN.encode(), filterStr, SearchControls.ONELEVEL_SCOPE, getContextMapper());
        } finally{
            Thread.currentThread().setContextClassLoader(currentClassLoader);
        }

        return results;
View Full Code Here

    public void add(Entity entity, Entity parentEntity) throws SecurityException
    {
        if (parentEntity == null || parentEntity.getInternalId() == null){
            throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(),"add(Entity entity, Entity parentEntity)","Provided parent entity is null or has no internal ID."));
        }       
        DistinguishedName parentDn = new DistinguishedName(parentEntity.getInternalId());
        parentDn.removeFirst(new DistinguishedName(configuration.getBaseDN()));
        internalAdd(entity,parentDn);       
    }
View Full Code Here

        internalAdd(entity,parentDn);       
    }

    public void add(Entity entity) throws SecurityException
    {
        DistinguishedName dn = new DistinguishedName();
        if (configuration.getSearchDN() != null && configuration.getSearchDN().length() > 0)
        {
            try
            {
                dn.addAll(new DistinguishedName(configuration.getSearchDN()));
            } catch (InvalidNameException inex)
            {
                throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(),"add(Entity entity)",inex));
            }
        }
View Full Code Here

public class DnUtils
{
    public static final String DEFAULT_SEPARATOR =  ",";
   
    public static final String encodeDnUsingSeparator(String separator, String... dnParts){
        DistinguishedName dn = new DistinguishedName();
        for (String dnPart : dnParts)
        {
            dn.append(new DistinguishedName(dnPart));
        }
        String encodedDn = dn.encode();
        return encodedDn.replace(", ", separator);
    }
View Full Code Here

                // Create the Sprint LDAP template
                LdapTemplate template = new LdapTemplate(contextSource);
   
                // Clear out any old data - and load the test data
                LdapTestUtils.cleanAndSetup(template.getContextSource(),
                        new DistinguishedName("dc=example,dc=com"),
                        new ClassPathResource(ldifPath));
                return true;
            }
            return false;
        } catch (Exception ee) {
View Full Code Here

        this.upcam = upcam;
        this.upcpm = upcpm;
        this.cpe =  cpe != null && (upcpm == null || upcpm.getCredentialPasswordEncoder() != cpe) ? cpe : null;
        this.poolingContextsource = poolingContextSource;
        this.userEntryPrefix = userEntryPrefix;       
        this.userSearchPath = new DistinguishedName(userSearchBase);
        if (!StringUtils.isEmpty(userFilter))
        {
            this.userFilter = new HardcodedFilter(userFilter);
        }       
        this.searchControls = new SearchControls();
View Full Code Here

            }
            else
            {
                ctx = poolingContextsource.getReadWriteContext();
            }
            DistinguishedName name = new DistinguishedName(dn);
            name.removeFirst(new DistinguishedName(ctx.getNameInNamespace()));
            Attribute namingAttr = new BasicAttribute("userPassword", newPassword);
            ModificationItem[] items = new ModificationItem[1];
            items[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, namingAttr);
            ctx.modifyAttributes(name, items);
        }
View Full Code Here

TOP

Related Classes of org.springframework.ldap.core.DistinguishedName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.