Examples of AttributesMapper


Examples of net.sf.ldaptemplate.AttributesMapper

   
    public String checkAlreadyExists(String login) {
        DistinguishedName webaccounts = new DistinguishedName();
        webaccounts.add("ou","webaccounts");

        List lst = getLdapTemplate().search(webaccounts, "cn=" + login, new AttributesMapper() {
            @Override
            public Object mapFromAttributes(Attributes attrs) throws NamingException {
               return attrs.get("cn").get();
            }
         });
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

    searchFilter.append(UID).append(username).append(",");
    searchFilter.append(ORGAINZATIONAL_UNIT);

    try {
      usernames = ldapTemplate.search(searchFilter.toString(),
          PERSON_OBJECTCLASS, new AttributesMapper() {
            @Override
            public Object mapFromAttributes(Attributes attrs)
                throws NamingException {
              return attrs.get(USER_ID).get();
            }
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

            AndFilter filter = new AndFilter();
            filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("cn", user));

            //find DN of user
            AttributesMapper mapper =
                new AttributesMapper() {
                    public Object mapFromAttributes(Attributes attrs) throws NamingException {
                        return attrs.get("distinguishedName").get();
                    }
                };
            @SuppressWarnings("rawtypes")
            List users =
                ldap.search(
                            "OU=users,DC=emea,DC=mycompany,DC=com",
                            filter.toString(),
                            SearchControls.SUBTREE_SCOPE,
                            mapper
                );

            Assert.isTrue(users.size() == 1, "Only one user expected");
            dn = (String)users.get(0);

            // get attributes
            AttributesMapper mapper2 =
                new AttributesMapper() {
                    public Object mapFromAttributes(Attributes attrs) throws NamingException {
                        Map<String, String> map = new HashMap<String, String>();
                        NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
                        while (attrEnum.hasMore()) {
                            Attribute att = attrEnum.next();
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

            AndFilter filter = new AndFilter();
            filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("cn", user));

            //find DN of user
            AttributesMapper mapper =
                new AttributesMapper() {
                    public Object mapFromAttributes(Attributes attrs) throws NamingException {
                        return attrs.get("distinguishedName").get();
                    }
                };
            @SuppressWarnings("rawtypes")
            List users =
                ldap.search(
                            "OU=users,DC=emea,DC=mycompany,DC=com",
                            filter.toString(),
                            SearchControls.SUBTREE_SCOPE,
                            mapper
                );

            Assert.isTrue(users.size() == 1, "Only one user expected");
            dn = (String)users.get(0);

            // get attributes
            AttributesMapper mapper2 =
                new AttributesMapper() {
                    public Object mapFromAttributes(Attributes attrs) throws NamingException {
                        Map<String, String> map = new HashMap<String, String>();
                        NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
                        while (attrEnum.hasMore()) {
                            Attribute att = attrEnum.next();
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

        }

        String[] searchAttributes = null;
        searchAttributes = searchAttributeList.toArray(new String[] {});

        AttributesMapper mapper =
            new AttributesMapper() {
                public Object mapFromAttributes(Attributes attrs) throws NamingException {
                    Map<String, String> map = new HashMap<String, String>();
                    NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
                    while (attrEnum.hasMore()) {
                        Attribute att = attrEnum.next();
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

        String dn = null;
        AndFilter filter = new AndFilter();
        filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("cn", principal));

        //find DN of user
        AttributesMapper mapper =
            new AttributesMapper() {
                public Object mapFromAttributes(Attributes attrs) throws NamingException {
                    return attrs.get("distinguishedName").get();
                }
            };
        @SuppressWarnings("rawtypes")
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

        }
       
        final String attributeId = getAttributeIds()[0];
        final List principalList = this.getLdapTemplate().search(
            getSearchBase(), LdapUtils.getFilterWithValues(getFilter(), formattedIpAddress), getSearchControls(),
            new AttributesMapper() {
                public Object mapFromAttributes(final Attributes attrs)
                    throws NamingException {
                    final Attribute attribute = attrs.get(attributeId);
                    return attribute == null ? null : attribute.get();
                }
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

            // searching the directory
            final String idAttribute = getAttributeIds()[0];
            final List principalList = getLdapTemplate().search(
                getSearchBase(), searchFilter, getSearchControls(),
               
                new AttributesMapper() {
                    public Object mapFromAttributes(final Attributes attrs)
                        throws NamingException {
                        final Attribute attribute = attrs.get(idAttribute);
                        if (attribute == null) {
                            log.debug("Principal attribute \"" + idAttribute + "\" "
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper


       
        Map<String, Attribute> ldapAttributes = null;
        if (useLdapLookup) {
            AttributesMapper mapper =
                new AttributesMapper() {
                    public Object mapFromAttributes(Attributes attrs) throws NamingException {
                        Map<String, Attribute> map = new HashMap<String, Attribute>();
                        NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
                        while (attrEnum.hasMore()) {
                            Attribute att = attrEnum.next();
View Full Code Here

Examples of org.springframework.ldap.core.AttributesMapper

        }

        String[] searchAttributes = null;
        searchAttributes = searchAttributeList.toArray(new String[] {});

        AttributesMapper mapper =
            new AttributesMapper() {
                public Object mapFromAttributes(Attributes attrs) throws NamingException {
                    Map<String, Attribute> map = new HashMap<String, Attribute>();
                    NamingEnumeration<? extends Attribute> attrEnum = attrs.getAll();
                    while (attrEnum.hasMore()) {
                        Attribute att = attrEnum.next();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.