Package org.springframework.ldap.core

Examples of org.springframework.ldap.core.AttributesMapper


        String objectClass, String filterAttributeName, String filterAttributeValue,
        String[] searchAttributes) {
       
        Map<String, Attribute> ldapAttributes = null;
       
        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


        String objectClass, String filterAttributeName, String filterAttributeValue,
        String searchAttribute) {

        List<String> ldapAttributes = null;

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

            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

            // We must make a search for each role-matching in nodes
            List<Attribute> resultsSearch = new ArrayList<Attribute>();
            resultsSearch.addAll(ldapTemplate.search(
                    DistinguishedName.EMPTY_PATH, new EqualsFilter(
                            roleProperty, roleLDAP.getRoleLdap()).toString(),
                    new AttributesMapper() {
                        @Override
                        public Object mapFromAttributes(Attributes attributes)
                                throws NamingException {
                            return attributes.get(configuration.getLdapUserId());
                        }
View Full Code Here

      filterBuilder.append(")");
      filterBuilder.append(groupSearchFilter);
    }
    filterBuilder.append(")");

    AttributesMapper attributesMapper = new AttributesMapper() {
      public Object mapFromAttributes(Attributes attrs)
          throws NamingException {
        return attrs.get(groupNamingAttribute).get();
      }
    };
View Full Code Here

        }

        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

        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

            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

            LOG.finest("Retrieve claims for user " + user);
        }
       
        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

        }

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

        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

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

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.