Package javax.naming.directory

Examples of javax.naming.directory.DirContext.addToEnvironment()


        Attributes attributes = createPerson( "cn" );
        String oldRdn = getRdn( attributes, "cn" );
        String newRdn = getRdn( attributes, "cn", "sn" );

        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "true" );
        ctx.rename( oldRdn, newRdn );

        // Check whether new Entry exists
        DirContext newCtx = ( DirContext ) ctx.lookup( newRdn );
        assertNotNull( newCtx );
View Full Code Here


    {
        DirContext ctx = ( DirContext ) getWiredContext( getLdapServer() ).lookup( BASE );

        // Change Rdn to another attribute
        String newRdn = "description=an American singer-songwriter";
        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
        ctx.rename( RDN, newRdn );

        // Remove description, which is now Rdn attribute
        Attribute attr = new BasicAttribute( "description" );
        Attributes attrs = new BasicAttributes( true );
View Full Code Here

        {
            // expected behaviour
        }

        // Change Rdn back to original
        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
        ctx.rename( newRdn, RDN );
    }


    /**
 
View Full Code Here

        cData.setURL("ldap://betch01:19389");
        DirContext ctx = BasicOps.openContext(cData);
        //DirContext ctx = BasicOps.openContext("ldap://betch01:19389");
        DXAttributes a = new DXAttributes(ctx.getAttributes("ou=Manufacturing,o=DEMOCORP,c=AU"));
        SchemaOps schemaOps = new SchemaOps(ctx);
        ctx.addToEnvironment("java.naming.ldap.attributes.binary", schemaOps.getNewBinaryAttributes());
//        DXAttributes.setDefaultSchema(schemaOps);
//        DXAttribute.setDefaultSchema(schemaOps);
        a.expandAllAttributes();
    }
View Full Code Here

        cData.setURL("ldap://betch01:19389");
        DirContext ctx = BasicOps.openContext(cData);
        //DirContext ctx = BasicOps.openContext("ldap://betch01:19389");
        DXAttributes a = new DXAttributes(ctx.getAttributes("ou=Manufacturing,o=DEMOCORP,c=AU"));
        SchemaOps schemaOps = new SchemaOps(ctx);
        ctx.addToEnvironment("java.naming.ldap.attributes.binary", schemaOps.getNewBinaryAttributes());
        DXAttributes.setDefaultSchema(schemaOps);
//        DXAttribute.setDefaultSchema(schemaOps);
        a.expandAllAttributes();
    }
    /**
 
View Full Code Here

        DirContext ctx = BasicOps.openContext(cData);

        //DirContext ctx = BasicOps.openContext("ldap://betch01:19389");
        DXAttributes a = new DXAttributes(ctx.getAttributes("ou=Manufacturing,o=DEMOCORP,c=AU"));
        SchemaOps schemaOps = new SchemaOps(ctx);
        ctx.addToEnvironment("java.naming.ldap.attributes.binary", schemaOps.getNewBinaryAttributes());
//        DXAttributes.setDefaultSchema(schemaOps);
        DXAttribute.setDefaultSchema(schemaOps);
        a.expandAllAttributes();
    }
    /**
 
View Full Code Here

        cData.setURL("ldap://betch01:19389");
        DirContext ctx = BasicOps.openContext(cData);
        //DirContext ctx = BasicOps.openContext("ldap://betch01:19389");
        DXAttributes a = new DXAttributes(ctx.getAttributes("ou=Manufacturing,o=DEMOCORP,c=AU"));
        SchemaOps schemaOps = new SchemaOps(ctx);
        ctx.addToEnvironment("java.naming.ldap.attributes.binary", schemaOps.getNewBinaryAttributes());
        DXAttributes.setDefaultSchema(schemaOps);
        DXAttribute.setDefaultSchema(schemaOps);
        a.expandAllAttributes();
    }
View Full Code Here

                    first_name = getAttributeValue(attrs, ATTR_FIRSTNAME);
                    last_name = getAttributeValue(attrs, ATTR_LASTNAME);
                    // re-bind as user
                    conn.removeFromEnvironment(javax.naming.Context.SECURITY_PRINCIPAL);
                    conn.removeFromEnvironment(javax.naming.Context.SECURITY_CREDENTIALS);
                    conn.addToEnvironment(javax.naming.Context.SECURITY_PRINCIPAL, dnBuffer.toString());
                    conn.addToEnvironment(javax.naming.Context.SECURITY_CREDENTIALS, this.myOpaqueCredentials.credentialstring);
                    searchCtls = new SearchControls();
                    searchCtls.setReturningAttributes(new String[0]);
                    searchCtls.setSearchScope(SearchControls.OBJECT_SCOPE);
   
View Full Code Here

                    last_name = getAttributeValue(attrs, ATTR_LASTNAME);
                    // re-bind as user
                    conn.removeFromEnvironment(javax.naming.Context.SECURITY_PRINCIPAL);
                    conn.removeFromEnvironment(javax.naming.Context.SECURITY_CREDENTIALS);
                    conn.addToEnvironment(javax.naming.Context.SECURITY_PRINCIPAL, dnBuffer.toString());
                    conn.addToEnvironment(javax.naming.Context.SECURITY_CREDENTIALS, this.myOpaqueCredentials.credentialstring);
                    searchCtls = new SearchControls();
                    searchCtls.setReturningAttributes(new String[0]);
                    searchCtls.setSearchScope(SearchControls.OBJECT_SCOPE);
   
                    String attrSearch = "(" + ldapConn.getUidAttribute() + "=*)";
 
View Full Code Here

        // -------------------------------------------------------------------
        // Now we will throw exceptions when searching for referrals
        // -------------------------------------------------------------------

        ctx.addToEnvironment( Context.REFERRAL, "throw" );
        list = ctx.search( "ou=system", "(objectClass=*)", controls );
        results = new HashMap<String,SearchResult>();

        try
        {
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.