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

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


            digetDigestMd5Request.setUsername( userDn.getRdn().getValue().getString() );
            digetDigestMd5Request.setCredentials( "secret" );
            digetDigestMd5Request.setRealmName( ldapServer.getSaslRealms().get( 0 ) );
            resp = connection.bind( digetDigestMd5Request );
            assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
            entry = connection.lookup( userDn );
            assertEquals( "hnelson", entry.get( "uid" ).getString() );
            connection.close();

            // Cram-MD5
            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
View Full Code Here


            SaslCramMd5Request cramMd5Request = new SaslCramMd5Request();
            cramMd5Request.setUsername( userDn.getRdn().getValue().getString() );
            cramMd5Request.setCredentials( "secret" );
            resp = connection.bind( cramMd5Request );
            assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
            entry = connection.lookup( userDn );
            assertEquals( "hnelson", entry.get( "uid" ).getString() );
            connection.close();

            // GSSAPI
            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
View Full Code Here

            gssApiRequest.setRealmName( ldapServer.getSaslRealms().get( 0 ) );
            gssApiRequest.setKdcHost( "localhost" );
            gssApiRequest.setKdcPort( 6088 );
            resp = connection.bind( gssApiRequest );
            assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
            entry = connection.lookup( userDn );
            assertEquals( "hnelson", entry.get( "uid" ).getString() );
            connection.close();
        }
    }
View Full Code Here

        new DefaultModification( ModificationOperation.ADD_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" ) );
    assertTrue( found.contains( "mail", Strings.EMPTY_BYTES ) );
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

    connection.modify( new Dn( "uid=12345,ou=system" ),
        new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, "mail" )
        );

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

    assertNotNull( found );
    assertNull( found.get( "mail" ) );
    assertNotNull( found.get( "userPassword" ) );
    assertEquals( 1, found.get( "userPassword" ).size() );
View Full Code Here

                    // Binding on the connection
                    connection.bind();

                    // Looking for the Root DSE entry
                    Entry rootDseEntry = connection.lookup( Dn.ROOT_DSE );
                    if ( rootDseEntry == null )
                    {
                        // This isn't good
                        verified = false;
                        return;
View Full Code Here

        // 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() ).
            addBinaryAttribute( "userPassword" );
View Full Code Here

        assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable() );

        // Now, load a new binary Attribute
        ( ( ConfigurableBinaryAttributeDetector ) config.getBinaryAttributeDetector() ).
            addBinaryAttribute( "userPassword" );
        entry = myConnection.lookup( "uid=admin,ou=system" );
        assertFalse( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable() );

        // Now, test using the scerver's schema
        ( ( LdapNetworkConnection ) connection ).loadSchema();
        connection.bind( "uid=admin,ou=system", "secret" );
View Full Code Here

        LdapConnection ldapConnection = new LdapNetworkConnection( "localHost", ldapServer.getPort() );

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

        // Try to retrieve a binary attribute : it should be seen as a String
        Entry entry = ldapConnection.lookup( "uid=admin,ou=system" );
        assertTrue( entry.get( SchemaConstants.USER_PASSWORD_AT ).get().isHumanReadable() );
    }


    /**
 
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.