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

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


        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


    public void testAnonBind() throws Exception
    {
        getLdapServer().getDirectoryService().setAllowAnonymousAccess( true );
        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );

        connection.bind();
        assertTrue( connection.isAuthenticated() );
        connection.close();
    }

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

     */
    public static LdapNetworkConnection createAdminConnection( LdapServer ldapServer ) throws LdapException,
        IOException
    {
        LdapNetworkConnection conn = new LdapNetworkConnection( DEFAULT_HOST, ldapServer.getPort() );
        conn.bind( DEFAULT_ADMIN, DEFAULT_PASSWORD );
        return conn;
    }


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

     */
    public static LdapConnection getAnonymousNetworkConnection( LdapServer ldapServer ) throws Exception
    {
        LdapConnection connection = new LdapNetworkConnection( "localHost", ldapServer.getPort() );
        connection.setTimeOut( 0L );
        connection.bind();

        return connection;
    }
}
View Full Code Here

        try
        {
            // Try to bind
            try
            {
                ldapConnection.bind( bindContext.getDn(),
                    Strings.utf8ToString( bindContext.getCredentials() ) );

                // no need to remain bound to delegate host
                ldapConnection.unBind();
            }
View Full Code Here

                    configuration.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector( null ) );
                    connection = new LdapNetworkConnection( configuration );
                    connection.loadSchema();

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

                    // Looking for the Root DSE entry
                    Entry rootDseEntry = connection.lookup( Dn.ROOT_DSE );
                   
                    if ( rootDseEntry == null )
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)
            connection.bind( "uid=admin,ou=system", "secret" );

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

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

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

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.