Package javax.naming.directory

Examples of javax.naming.directory.Attributes


            // Make the distinguished name.
            String dn = "turbineRoleName=" + roleName + ","
                    + LDAPSecurityConstants.getBaseSearch();

            // Make the attributes.
            Attributes attrs = new BasicAttributes();

            attrs.put(new BasicAttribute("turbinePermissionName", permName));

            // Connect to LDAP.
            DirContext ctx = LDAPUserManager.bindAsAdmin();

            // Remove the permission.
View Full Code Here


            NamingEnumeration answer = ctx.search(baseSearch, filter, ctls);

            while (answer.hasMore())
            {
                SearchResult sr = (SearchResult) answer.next();
                Attributes attribs = sr.getAttributes();
                Attribute attr = attribs.get("turbineGroupName");

                if (attr != null && attr.get() != null)
                {
                    Group group = getNewGroup(attr.get().toString());
View Full Code Here

            NamingEnumeration answer = ctx.search(baseSearch, filter, ctls);

            while (answer.hasMore())
            {
                SearchResult sr = (SearchResult) answer.next();
                Attributes attribs = sr.getAttributes();
                Attribute attr = attribs.get("turbineRoleName");

                if (attr != null)
                {
                    NamingEnumeration values = attr.getAll();
View Full Code Here

                    ctx.search(userBaseSearch, filter, ctls);

            if (answer.hasMore())
            {
                SearchResult sr = (SearchResult) answer.next();
                Attributes attribs = sr.getAttributes();
                LDAPUser ldapUser = createLDAPUser();

                ldapUser.setLDAPAttributes(attribs);
                ldapUser.setTemp("turbine.user", ldapUser);
View Full Code Here

                    ctx.search(userBaseSearch.toString(), (Attributes)null);

            if (answer.hasMore())
            {
                SearchResult sr = (SearchResult) answer.next();
                Attributes attribs = sr.getAttributes();
                LDAPUser ldapUser = createLDAPUser();

                ldapUser.setLDAPAttributes(attribs);
                ldapUser.setTemp("turbine.user", ldapUser);
View Full Code Here

                    ctx.search(userBaseSearch, filter, ctls);

            while (answer.hasMore())
            {
                SearchResult sr = (SearchResult) answer.next();
                Attributes attribs = sr.getAttributes();
                LDAPUser ldapUser = createLDAPUser();

                ldapUser.setLDAPAttributes(attribs);
                ldapUser.setTemp("turbine.user", ldapUser);
                users.add(ldapUser);
View Full Code Here

        }

        try
        {
            LDAPUser ldapUser = (LDAPUser) user;
            Attributes attrs = ldapUser.getLDAPAttributes();
            String name = ldapUser.getDN();

            DirContext ctx = bindAsAdmin();

            ctx.modifyAttributes(name, DirContext.REPLACE_ATTRIBUTE, attrs);
View Full Code Here

        }

        try
        {
            LDAPUser ldapUser = (LDAPUser) user;
            Attributes attrs = ldapUser.getLDAPAttributes();
            String name = ldapUser.getDN();

            DirContext ctx = bindAsAdmin();

            ctx.bind(name, null, attrs);
View Full Code Here

     * @return The JNDI attributes of the user.
     */
    public Attributes getLDAPAttributes()
            throws NamingException
    {
        Attributes attribs = new BasicAttributes();
        String attrName;

        // Set the objectClass
        attrName = "objectClass";
        if (attrName != null)
        {
            Object value = "turbineUser";

            if (value != null)
            {
                Attribute attr = new BasicAttribute(attrName, value);

                attribs.put(attr);
            }
        }

        // Set the User id.
        attrName = LDAPSecurityConstants.getUserIdAttribute();
        if (attrName != null)
        {
            Object value = getPrimaryKey();

            if (value != null)
            {
                Attribute attr = new BasicAttribute(attrName, value);

                attribs.put(attr);
            }
        }

        // Set the Username.
        attrName = LDAPSecurityConstants.getNameAttribute();
        if (attrName != null)
        {
            Object value = getName();

            if (value != null)
            {
                Attribute attr = new BasicAttribute(attrName, value);

                attribs.put(attr);
            }
        }

        // Set the Firstname.
        attrName = LDAPSecurityConstants.getFirstNameAttribute();
        if (attrName != null)
        {
            Object value = getFirstName();

            if (value != null)
            {
                Attribute attr = new BasicAttribute(attrName, value);

                attribs.put(attr);
            }
        }

        // Set the Lastname.
        attrName = LDAPSecurityConstants.getLastNameAttribute();
        if (attrName != null)
        {
            Object value = getLastName();

            if (value != null)
            {
                Attribute attr = new BasicAttribute(attrName, value);

                attribs.put(attr);
            }
        }

        // Set the E-Mail.
        attrName = LDAPSecurityConstants.getEmailAttribute();
        if (attrName != null)
        {
            Object value = getEmail();

            if (value != null)
            {
                Attribute attr = new BasicAttribute(attrName, value);

                attribs.put(attr);
            }
        }

        // Set the Password
        attrName = LDAPSecurityConstants.getPasswordAttribute();
        if (attrName != null)
        {
            Object value = getPassword();

            if (value != null)
            {
                Attribute attr = new BasicAttribute(attrName, value);

                attribs.put(attr);
            }
        }

        return attribs;
    }
View Full Code Here

        }

        if( context instanceof DirContext )
        {
            //extract element name, and namespace prefix
            final Attributes attrs = ( (DirContext)context ).getAttributes( "" );

            final NamingEnumeration attributes = attrs.getAll();
            while( attributes.hasMore() )
            {
                final Attribute attribute = (Attribute)attributes.next();
                final String id = attribute.getID();
                if( name.startsWith( id ) )
                {
                    name = (String)attribute.get();
                    if( m_enableNamespaces ) prefix = id;
                    attrs.remove( id );
                    break;
                }
            }

            configuration = new DefaultConfiguration( name, null, "", prefix );
View Full Code Here

TOP

Related Classes of javax.naming.directory.Attributes

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.