Examples of BasicAttributes


Examples of javax.naming.directory.BasicAttributes

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

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

            attrs.put(new BasicAttribute("objectClass", "turbineGroup"));
            attrs.put(new BasicAttribute("turbineGroupName", groupName));

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

            // Add the group in LDAP.
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

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

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

            attrs.put(new BasicAttribute("objectClass", "turbineRole"));
            attrs.put(new BasicAttribute("turbineRoleName", roleName));

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

            // Add the role in LDAP.
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

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

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

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

            DirContext ctx = LDAPUserManager.bindAsAdmin();

            // Add the permission in LDAP.
            ctx.bind(dn, null, attrs);
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

     * @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

Examples of javax.naming.directory.BasicAttributes

        BasicAttribute basicattribute = new BasicAttribute("objectclass"); //$NON-NLS-1$
        basicattribute.add("top"); //$NON-NLS-1$
        basicattribute.add("person"); //$NON-NLS-1$
        basicattribute.add("organizationalPerson"); //$NON-NLS-1$
        basicattribute.add("inetOrgPerson"); //$NON-NLS-1$
        BasicAttributes attrs = new BasicAttributes(true);
        attrs.put(basicattribute);
        BasicAttribute attr;
        PropertyIterator iter = getArguments().iterator();

        while (iter.hasNext()) {
            Argument item = (Argument) iter.next().getObjectValue();
            attr = getBasicAttribute(item.getName(), item.getValue());
            attrs.put(attr);
        }
        return attrs;
    }
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

     * Test.
     *
     * @return the BasicAttributes
     */
    private BasicAttributes getBasicAttributes() {
        BasicAttributes basicattributes = new BasicAttributes();
        BasicAttribute basicattribute = new BasicAttribute("objectclass"); //$NON-NLS-1$
        basicattribute.add("top"); //$NON-NLS-1$
        basicattribute.add("person"); //$NON-NLS-1$
        basicattribute.add("organizationalPerson"); //$NON-NLS-1$
        basicattribute.add("inetOrgPerson"); //$NON-NLS-1$
        basicattributes.put(basicattribute);
        String s1 = "User"; //$NON-NLS-1$
        String s3 = "Test"; //$NON-NLS-1$
        String s5 = "user"; //$NON-NLS-1$
        String s6 = "test"; //$NON-NLS-1$
        counter += 1;
        basicattributes.put(new BasicAttribute("givenname", s1)); //$NON-NLS-1$
        basicattributes.put(new BasicAttribute("sn", s3)); //$NON-NLS-1$
        basicattributes.put(new BasicAttribute("cn", "TestUser" + counter)); //$NON-NLS-1$ //$NON-NLS-2$
        basicattributes.put(new BasicAttribute("uid", s5)); //$NON-NLS-1$
        basicattributes.put(new BasicAttribute("userpassword", s6)); //$NON-NLS-1$
        setProperty(new StringProperty(ADD, "cn=TestUser" + counter)); //$NON-NLS-1$
        return basicattributes;
    }
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

            {
                return readContextEntry( valueElement.getText() );
            }
        }

        return new BasicAttributes( true );
    }
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

                    monitor.reportError( e );
                    return;
                }
            }

            Attributes jndiAttributes = new BasicAttributes();
            for ( LdifAttrValLine attrVal : attrVals )
            {
                String attributeName = attrVal.getUnfoldedAttributeDescription();
                Object realValue = attrVal.getValueAsObject();

                if ( jndiAttributes.get( attributeName ) != null )
                {
                    jndiAttributes.get( attributeName ).add( realValue );
                }
                else
                {
                    jndiAttributes.put( attributeName, realValue );
                }
            }

            browserConnection.getConnection().getJNDIConnectionWrapper().createEntry( dn, jndiAttributes,
                getControls( record ), monitor, null );
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

    {
        // dn
        String dn = entryToCreate.getDn().getUpName();

        // attributes
        Attributes jndiAttributes = new BasicAttributes();
        IAttribute[] attributes = entryToCreate.getAttributes();
        for ( int i = 0; i < attributes.length; i++ )
        {
            String description = attributes[i].getDescription();
            IValue[] values = attributes[i].getValues();
            for ( int ii = 0; ii < values.length; ii++ )
            {
                IValue value = values[ii];
                Object rawValue = value.getRawValue();
                if ( jndiAttributes.get( description ) != null )
                {
                    jndiAttributes.get( description ).add( rawValue );
                }
                else
                {
                    jndiAttributes.put( description, rawValue );
                }
            }
        }

        // ManageDsaIT control
View Full Code Here

Examples of javax.naming.directory.BasicAttributes

         //
         LdapContext ctx = (LdapContext)ldapContext.lookup(getContainerDN());

         //We store new entry using set of attributes. This should give more flexibility then
         //extending user object from ContextDir - configure what objectClass place there
         Attributes attrs = new BasicAttributes(true);

         //create attribute using provided configuration
         Map attributesToAdd = getAttributesToAdd();

         //attributes
         for (Iterator it1 = attributesToAdd.keySet().iterator(); it1.hasNext();)
         {
            String attributeName = (String)it1.next();
            if (getUidAttributeID().equals(attributeName))
            {
               continue;
            }
            log.debug("adding attribute: " + attributeName);
            Attribute attr = new BasicAttribute(attributeName);
            Set attributeValues = (Set)attributesToAdd.get(attributeName);

            //values
            for (Iterator it2 = attributeValues.iterator(); it2.hasNext();)
            {
               String attrValue = (String)it2.next();
               log.debug("adding attribute value: " + attrValue);
               attr.add(attrValue);
            }
            attrs.put(attr);
         }

         if (!isSetPasswordAfterUserCreate())
         {
            attrs.put(getPasswordAttributeId(), password);
         }

         String validUserName = LDAPTools.encodeRfc2253Name(userName);

         String dn = getUidAttributeID().concat("=").concat(validUserName);
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.