Package org.apache.directory.ldap.client.api

Examples of org.apache.directory.ldap.client.api.LdapNetworkConnection.bind()


            throw e;
        } catch (Exception e) {
            // unhandled different exception, should really not happen here.
            throw new LdapException("Unexpected error connecting to LDAP", e);
        }
        connection.bind();

        return connection;
    }

    public LdapEntry search(LdapNetworkConnection connection, String searchBase, String searchPattern, String principal, boolean activeDirectory) throws LdapException, CursorException {
View Full Code Here


    public void testAddPDUExceedingMaxSizeLdapApi() throws Exception
    {
        // Limit the PDU size to 1024
        getLdapServer().getDirectoryService().setMaxPDUSize( 1024 );
        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.bind( "uid=admin,ou=system", "secret" );

        // Inject a 1024 bytes long description
        StringBuilder sb = new StringBuilder();

        for ( int i = 0; i < 128; i++ )
View Full Code Here

        assertFalse( connection.isConnected() );
        connection.close();

        // Try with empty strings
        connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.bind( "", "" );

        assertTrue( connection.isAuthenticated() );

        connection.unBind();
        assertFalse( connection.isConnected() );
View Full Code Here

        assertFalse( connection.isConnected() );
        connection.close();

        // Try with null parameters
        connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.bind( ( String ) null, ( String ) null );

        assertTrue( connection.isAuthenticated() );
        assertTrue( connection.isConnected() );

        connection.unBind();
View Full Code Here

     */
    @Test
    public void testPsearchMove() throws Exception
    {
        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
        connection.bind( "uid=admin,ou=system", "secret" );
       
        Entry newOu = new DefaultEntry( "uid=persist, ou=users,ou=system" );
        newOu.add( "objectClass", "inetOrgPerson" );
        newOu.add( "cn", "persist_cn" );
        newOu.add( "sn", "persist_sn" );
View Full Code Here

            }
           
            LdapNetworkConnection c = new LdapNetworkConnection( url.getHost(), url.getPort(), useSsl );
            c.setTimeOut( Long.MAX_VALUE );
            c.connect();
            c.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
            System.out.println( "connected to the server " + url );
            connections.add( c );
        }
    }
   
View Full Code Here

    public void testAddPDUExceedingMaxSizeLdapApi() throws Exception
    {
        // Limit the PDU size to 1024
        getLdapServer().getDirectoryService().setMaxPDUSize( 1024 );
        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.bind( "uid=admin,ou=system", "secret" );

        // Inject a 1024 bytes long description
        StringBuilder sb = new StringBuilder();

        for ( int i = 0; i < 128; i++ )
View Full Code Here

    {
        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.setTimeOut( 0L );

        // Use the client API
        connection.bind( "uid=admin,ou=system", "secret" );

        // Add a new entry with some null values
        Entry entry = new DefaultEntry( "cn=test,ou=system",
            "ObjectClass: top",
            "ObjectClass: person",
View Full Code Here

    {
        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.setTimeOut( 0L );

        // Use the client API
        connection.bind( "uid=admin,ou=system", "secret" );

        // Add a new entry with some null values
        Entry entry = new DefaultEntry( "cn=test,ou=system",
            "ObjectClass: top",
            "ObjectClass: person",
View Full Code Here

        try
        {
            // Use the client API as JNDI cannot be used to do a search without
            // first binding. (hmmm, even client API won't allow searching without binding)
            asyncCnx.bind( "uid=admin,ou=system", "secret" );

            // First, add 100 entries in the server
            for ( int i = 0; i < 100; i++ )
            {
                String dn = "cn=user" + i + "," + BASE;
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.