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

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


        String newDn = newRdn + "," + BASE;

        connection.rename( oldDn, newRdn, true );

        // Check, whether old Entry does not exists
        assertNull( connection.lookup( oldDn ) );

        // Check, whether new Entry exists
        tori = connection.lookup( newDn );

        assertNotNull( tori );
View Full Code Here


        // Check, whether old Entry does not exists
        assertNull( connection.lookup( oldDn ) );

        // Check, whether new Entry exists
        tori = connection.lookup( newDn );

        assertNotNull( tori );

        // Check values of cn
        assertTrue( tori.contains( "cn", newCn ) );
View Full Code Here

        DeleteRequest deleteRequest = new DeleteRequestImpl();
        deleteRequest.setName( new Dn( "uid=akarasuluref,ou=users,ou=system" ) );
        deleteRequest.addControl( manageDSAIT );
        conn.delete( deleteRequest );

        assertNull( conn.lookup( "uid=akarasuluref,ou=users,ou=system", new Control[]
            { manageDSAIT } ) );

        conn.close();
    }
View Full Code Here

        LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );

        byte[] plainPwd = "secret".getBytes();
        Dn dn = new Dn( "cn=test,ou=system" );

        Entry entry = connection.lookup( dn );
        Attribute pwdAt = entry.get( SchemaConstants.USER_PASSWORD_AT );

        assertFalse( Arrays.equals( plainPwd, pwdAt.getBytes() ) );
        assertTrue( PasswordUtil.compareCredentials( plainPwd, pwdAt.getBytes() ) );
    }
View Full Code Here

        pwdAt.add( plainPwd );

        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, pwdAt );
        connection.modify( dn, mod );

        Entry entry = connection.lookup( dn );
        pwdAt = entry.get( pwdAtType );

        assertFalse( Arrays.equals( plainPwd, pwdAt.getBytes() ) );
        assertTrue( PasswordUtil.compareCredentials( plainPwd, pwdAt.getBytes() ) );
    }
View Full Code Here

        pwdAt.add( ( byte[] ) null );

        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, pwdAt );
        connection.modify( dn, mod );

        Entry entry = connection.lookup( dn );
        pwdAt = entry.get( pwdAtType );

        assertNull( pwdAt );
    }
View Full Code Here

        entry.add( "cn", "testHash" );
        entry.add( SchemaConstants.USER_PASSWORD_AT, hashedPwd );

        connection.add( entry );

        entry = connection.lookup( dn );
        Attribute pwdAt = entry.get( SchemaConstants.USER_PASSWORD_AT );
        assertTrue( Arrays.equals( hashedPwd, pwdAt.getBytes() ) );
        assertTrue( PasswordUtil.compareCredentials( plainPwd, pwdAt.getBytes() ) );

        connection.delete( dn );
View Full Code Here

        pwdAt.add( hashedPwd );

        Modification mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, pwdAt );
        connection.modify( dn, mod );

        Entry entry = connection.lookup( dn );
        pwdAt = entry.get( pwdAtType );

        assertTrue( Arrays.equals( hashedPwd, pwdAt.getBytes() ) );
        assertTrue( PasswordUtil.compareCredentials( plainPwd, pwdAt.getBytes() ) );
    }
View Full Code Here

        modifyDnRequest.setNewRdn( new Rdn( "uid=ref" ) );
        modifyDnRequest.setDeleteOldRdn( true );
        modifyDnRequest.addControl( manageDSAIT );

        conn.modifyDn( modifyDnRequest );
        Entry entry = conn.lookup( "uid=ref,ou=users,ou=system", new Control[]
            { manageDSAIT } );
        assertNotNull( entry );
        assertEquals( "uid=ref,ou=users,ou=system", entry.getDn().getName() );

        conn.close();
View Full Code Here

            new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "userPassword", Strings.EMPTY_BYTES ),
            new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, "mail", ( String ) null )
            );

        // Get back the entry
        Entry found = connection.lookup( "uid=12345,ou=system" );

        assertNotNull( found );
        assertNotNull( found.get( "mail" ) );
        assertNotNull( found.get( "userPassword" ) );
        assertEquals( 1, found.get( "mail" ).size() );
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.