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

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



    public static LdapConnection getClientApiConnection( LdapServer ldapServer ) throws Exception
    {
        LdapConnection conn = new LdapConnection( "localhost", ldapServer.getPort() );
        conn.bind( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
        return conn;
    }

}
View Full Code Here


    {
        LdapConnection connection = null;
        try
        {
            connection = new LdapConnection( config );
            BindResponse bindResponse = connection.bind( "uid=admin,ou=system", "secret" );
           
            assertNotNull( bindResponse );
           
            connection.unBind();
        }
View Full Code Here

    public void testGetSupportedControls() throws Exception
    {
        LdapConnection connection = new LdapConnection( config );

        DN dn = new DN( "uid=admin,ou=system" );
        connection.bind( dn.getName(), "secret" );
       
        List<String> controlList = connection.getSupportedControls();
        assertNotNull( controlList );
        assertFalse( controlList.isEmpty() );
    }
View Full Code Here

    public void testBindRequest() throws Exception
    {
        LdapConnection connection = new LdapConnection( "localhost", ldapServer.getPort() );
        try
        {
            BindResponse bindResponse = connection.bind( ADMIN_DN, "secret" );
           
            assertNotNull( bindResponse );
           
            //connection.unBind();
        }
View Full Code Here

    {
        long t1 = System.currentTimeMillis();

        // Create connection
        LdapConnection connection = new LdapConnection( "localhost", ldapServer.getPort() );
        connection.bind( "uid=admin,ou=system", "secret" );

        long t2 = System.currentTimeMillis();

        Cursor<SearchResponse> cursor = connection.search( "dc=example,dc=com", "(objectClass=*)", SearchScope.SUBTREE,
            "*" );
View Full Code Here

            LdapConnection connection = null;
            try {
                DebugTimer timer = new DebugTimer();
                connection = userPool.getConnection();
                timer.mark("connect");
                connection.bind(user.getExternalId().getId(), new String(creds.getPassword()));
                timer.mark("bind");
                if (log.isDebugEnabled()) {
                    log.debug("authenticate({}) {}", user.getId(), timer.getString());
                }
            } catch (LdapAuthenticationException e) {
View Full Code Here

            connection.unBind();
            assertFalse( connection.isConnected() );
   
            // Try with null parameters
            connection = new LdapConnection( "localhost", ldapServer.getPort() );
            bindResponse = connection.bind( (String)null, (String)null );
           
            assertNotNull( bindResponse );
            assertNotNull( bindResponse.getLdapResult() );
            assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
            assertEquals( 1, bindResponse.getMessageId() );
View Full Code Here

            //System.out.println( "------------------Create connection" + i + "-------------" );
            LdapConnection connection = new LdapConnection( "localhost", ldapServer.getPort() );
            //System.out.println( "------------------Bind" + i + "-------------" );
           
            // Try with no parameters
            BindResponse bindResponse = connection.bind();
           
            assertNotNull( bindResponse );
            assertNotNull( bindResponse.getLdapResult() );
            assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
            assertEquals( 1, bindResponse.getMessageId() );
View Full Code Here

            connection.unBind();
            assertFalse( connection.isConnected() );
   
            // Try with empty strings
            connection = new LdapConnection( "localhost", ldapServer.getPort() );
            bindResponse = connection.bind( "", "" );
           
            assertNotNull( bindResponse );
            assertNotNull( bindResponse.getLdapResult() );
            assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
            assertEquals( 1, bindResponse.getMessageId() );
View Full Code Here

            "ObjectClass: top",
            "ObjectClass: person",
            "sn: TEST",
            "cn: test" );

        connection.bind( "uid=admin,ou=system", "secret" );
        connection.add( entry );
        int nbIterations = 15000;

        long t0 = System.currentTimeMillis();
        long t00 = 0L;
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.