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

Examples of org.apache.directory.ldap.client.api.LdapConnectionConfig


    private void doConnect( final StudioProgressMonitor monitor ) throws Exception
    {
        ldapConnection = null;
        isConnected = true;

        ldapConnectionConfig = new LdapConnectionConfig();
        ldapConnectionConfig.setLdapHost( connection.getHost() );
        ldapConnectionConfig.setLdapPort( connection.getPort() );
        binaryAttributeDetector = new DefaultConfigurableBinaryAttributeDetector();
        ldapConnectionConfig.setBinaryAttributeDetector( binaryAttributeDetector );
        if ( ( connection.getEncryptionMethod() == EncryptionMethod.LDAPS )
View Full Code Here


        if (adminConnectionFactory != null) {
            throw new IllegalStateException("Provider already initialized.");
        }

        // setup admin connection pool
        LdapConnectionConfig cc = createConnectionConfig();
        if (!config.getBindDN().isEmpty()) {
            cc.setName(config.getBindDN());
            cc.setCredentials(config.getBindPassword());
        }
        adminConnectionFactory = new PoolableLdapConnectionFactory(cc);

        if (config.getAdminPoolConfig().getMaxActive() != 0) {
            adminPool = new LdapConnectionPool(adminConnectionFactory);
View Full Code Here

     * Creates a new connection config based on the config.
     * @return the connection config.
     */
    @Nonnull
    private LdapConnectionConfig createConnectionConfig() {
        LdapConnectionConfig cc = new LdapConnectionConfig();
        cc.setLdapHost(config.getHostname());
        cc.setLdapPort(config.getPort());
        cc.setUseSsl(config.useSSL());
        cc.setUseTls(config.useTLS());

        // todo: implement better trustmanager/keystore management (via sling/felix)
        if (config.noCertCheck()) {
            cc.setTrustManagers(new NoVerificationTrustManager());
        }
        return cc;
    }
View Full Code Here

    private void doConnect( final StudioProgressMonitor monitor ) throws Exception
    {
        ldapConnection = null;
        isConnected = true;

        ldapConnectionConfig = new LdapConnectionConfig();
        ldapConnectionConfig.setLdapHost( connection.getHost() );
        ldapConnectionConfig.setLdapPort( connection.getPort() );
        binaryAttributeDetector = new DefaultConfigurableBinaryAttributeDetector();
        ldapConnectionConfig.setBinaryAttributeDetector( binaryAttributeDetector );
        if ( ( connection.getEncryptionMethod() == EncryptionMethod.LDAPS )
View Full Code Here

    private LdapConnectionConfig tlsConfig;

    @Before
    public void setup()
    {
        sslConfig = new LdapConnectionConfig();
        sslConfig.setLdapHost( "localhost" );
        sslConfig.setUseSsl( true );
        sslConfig.setLdapPort( getLdapServer().getPortSSL() );
        sslConfig.setTrustManagers( new NoVerificationTrustManager() );
       
        tlsConfig = new LdapConnectionConfig();
        tlsConfig.setLdapHost( "localhost" );
        tlsConfig.setLdapPort( getLdapServer().getPort() );
        tlsConfig.setTrustManagers( new NoVerificationTrustManager() );
    }
View Full Code Here

    @Test
    public void testRetrieveBinaryAttibute() throws Exception
    {
        // test with a local connection using a local BinaryAttributeDetector
        LdapConnectionConfig config = new LdapConnectionConfig();
        config.setLdapHost( "localhost" );
        config.setLdapPort( ldapServer.getPort() );
        config.setName( ServerDNConstants.ADMIN_SYSTEM_DN );
        config.setCredentials( "secret" );
        config.setBinaryAttributeDetector( new DefaultConfigurableBinaryAttributeDetector() );

        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() ).
            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
View Full Code Here

     * inject a BinaryAttributeDetector
     */
    @Test
    public void testNoSchemaConnectionWithBinaryDetector() throws Exception
    {
        LdapConnectionConfig config = new LdapConnectionConfig();
        config.setLdapHost( "localhost" );
        config.setLdapPort( ldapServer.getPort() );
        config.setBinaryAttributeDetector( new DefaultConfigurableBinaryAttributeDetector() );

        LdapConnection ldapConnection = new LdapNetworkConnection( config );

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

View Full Code Here

TOP

Related Classes of org.apache.directory.ldap.client.api.LdapConnectionConfig

Copyright © 2018 www.massapicom. 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.