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

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


        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)
            connection.bind( "uid=admin,ou=system", "secret" );

            // Searches for all the entries in ou=system
            EntryCursor cursor = connection.search( "ou=system", "(ObjectClass=*)",
                SearchScope.SUBTREE, "*" );

View Full Code Here


    @Test
    public void testSearch100kUsers() throws LdapException, CursorException, InterruptedException
    {
        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        connection.bind( "uid=admin,ou=system", "secret" );

        Entry rootPeople = new DefaultEntry(
            "ou=People,dc=example,dc=com",
            "objectClass: top",
            "objectClass: organizationalUnit",
View Full Code Here

        assertTrue( getService().isStarted() );
        assertEquals( "DelegatedAuthIT-method", getService().getInstanceId() );
        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );

        ldapConnection.setTimeOut( 0L );
        ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );

        assertTrue( ldapConnection.isAuthenticated() );

        ldapConnection.unBind();
View Full Code Here

        ldapConnection.unBind();

        try
        {
            ldapConnection.bind( "uid=antoine,ou=users,ou=system", "sesame" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            assertTrue( true );
View Full Code Here

    public void testBindRequest() throws Exception
    {
        LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
        try
        {
            connection.bind( ADMIN_DN, "secret" );

            assertTrue( connection.isAuthenticated() );
        }
        finally
        {
View Full Code Here

        LdapConnection myConnection = new LdapNetworkConnection( config );

        // Remove the UserPassword from the list
        ( ( ConfigurableBinaryAttributeDetector ) config.getBinaryAttributeDetector() ).
            removeBinaryAttribute( "userPassword" );
        myConnection.bind( "uid=admin,ou=system", "secret" );
        Entry entry = myConnection.lookup( "uid=admin,ou=system" );
        assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable() );

        // Now, load a new binary Attribute
        ( ( ConfigurableBinaryAttributeDetector ) config.getBinaryAttributeDetector() ).
View Full Code Here

        config.setLdapPort( ldapServer.getPort() );
        config.setBinaryAttributeDetector( new DefaultConfigurableBinaryAttributeDetector() );

        LdapConnection ldapConnection = new LdapNetworkConnection( config );

        ldapConnection.bind( "uid=admin,ou=system", "secret" );

        // Try to retrieve a binary attribute : it should be seen as a byte[]
        Entry entry = ldapConnection.lookup( "uid=admin,ou=system" );
        assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable() );
       
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( "uid=12345,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( "uid=12345,ou=system",
            "ObjectClass: top",
            "ObjectClass: person",
View Full Code Here

     * @exception If the connection could not be established.
     */
    public static LdapConnection getAnonymousNetworkConnection( String host, int port ) throws Exception
    {
        LdapConnection connection = new LdapNetworkConnection( host, port );
        connection.bind();

        return connection;
    }


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.