Examples of LdapConnectionConfig


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

    }


    private LdapConnectionPool createLdapConnectionPool( LdapServer ldapServer )
    {
        LdapConnectionConfig config = new LdapConnectionConfig();
        config.setLdapHost( "localhost" );
        config.setLdapPort( ldapServer.getPort() );
        config.setName( "uid=admin,ou=system" );
        config.setCredentials( "secret" );
        if ( createLdapConnectionPool.additionalBinaryAttributes() != null
            && createLdapConnectionPool.additionalBinaryAttributes().length > 0 )
        {
            DefaultConfigurableBinaryAttributeDetector binaryAttributeDetector =
                new DefaultConfigurableBinaryAttributeDetector();
            binaryAttributeDetector.addBinaryAttribute(
                createLdapConnectionPool.additionalBinaryAttributes() );
            config.setBinaryAttributeDetector( binaryAttributeDetector );
        }

        DefaultLdapConnectionFactory factory = new DefaultLdapConnectionFactory( config );
        factory.setTimeOut( createLdapConnectionPool.timeout() );
View Full Code Here

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

                LdapNetworkConnection connection = null;
               
                try
                {
                    // Creating a connection on the created server
                    LdapConnectionConfig configuration = new LdapConnectionConfig();
                    configuration.setLdapHost( "localhost" );
                    configuration.setLdapPort( 10389 );
                    configuration.setName( ServerDNConstants.ADMIN_SYSTEM_DN );
                    configuration.setCredentials( PartitionNexus.ADMIN_PASSWORD_STRING );
                    configuration.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector( null ) );
                    connection = new LdapNetworkConnection( configuration );
                    connection.loadSchema();

                    // Binding on the connection
                    connection.bind();
View Full Code Here

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

            {
                return new X509Certificate[0];
            }
        };

        config = new LdapConnectionConfig();
        config.setLdapHost( "localhost" );
        config.setUseSsl( true );
        config.setLdapPort( ldapServer.getPortSSL() );
        config.setTrustManagers( new TrustManager[]{ X509 } );
    }
View Full Code Here

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

        if (adminPool != 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());
        }

        PoolableLdapConnectionFactory factory = new PoolableLdapConnectionFactory(cc);
        adminPool = new LdapConnectionPool(factory);
        adminPool.setTestOnBorrow(true);
View Full Code Here

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

     * 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

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

            public void run()
            {
                try
                {
                    // Creating a connection on the created server
                    LdapConnectionConfig configuration = new LdapConnectionConfig();
                    configuration.setLdapHost( "localhost" );
                    configuration.setLdapPort( 10389 );
                    configuration.setName( ServerDNConstants.ADMIN_SYSTEM_DN );
                    configuration.setCredentials( PartitionNexus.ADMIN_PASSWORD_STRING );
                    LdapNetworkConnection connection = new LdapNetworkConnection( configuration );

                    // Binding on the connection
                    connection.bind();
View Full Code Here

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

     * from configuration instead of empty values).
     */
    @Test
    public void testDIRAPI47() throws Exception
    {
        LdapConnectionConfig config = new LdapConnectionConfig();
        config.setLdapHost( "localhost" );
        config.setLdapPort( getLdapServer().getPort() );
        config.setName( "uid=nonexisting,dc=example,dc=com" );

        connection = new LdapNetworkConnection( config );
        connection.anonymousBind();

        assertTrue( connection.isAuthenticated() );
View Full Code Here

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


    @Before
    public void setup()
    {
        sslConfig = new LdapConnectionConfig();
        sslConfig.setLdapHost( "localhost" );
        sslConfig.setUseSsl( true );
        sslConfig.setLdapPort( getLdapServer().getPortSSL() );
        sslConfig.setTrustManagers( new NoVerificationTrustManager() );
        sslConfig.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector(
                ldapServer.getDirectoryService().getSchemaManager() ) );

        tlsConfig = new LdapConnectionConfig();
        tlsConfig.setLdapHost( "localhost" );
        tlsConfig.setLdapPort( getLdapServer().getPort() );
        tlsConfig.setTrustManagers( new NoVerificationTrustManager() );
        tlsConfig.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector(
            ldapServer.getDirectoryService().getSchemaManager() ) );
View Full Code Here

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

    @Test(expected = InvalidConnectionException.class)
    @Ignore( "This test is failing from time to time when runnig integ tests... To be investgated")
    public void testStallingSsl() throws Exception
    {
        LdapConnectionConfig sslConfig = new LdapConnectionConfig();
        sslConfig.setLdapHost( "localhost" );
        sslConfig.setUseSsl( true );
        sslConfig.setLdapPort( getLdapServer().getPortSSL() );
        //sslConfig.setTrustManagers( new NoVerificationTrustManager() );

        LdapNetworkConnection connection = new LdapNetworkConnection( sslConfig );

        // We should get an exception here, as we don't have a trustManager defined
View Full Code Here

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

    {
        int port = ldapServer.getPort();

        if ( !pools.containsKey( port ) )
        {
            LdapConnectionConfig config = new LdapConnectionConfig();
            config.setLdapHost( DEFAULT_HOST );
            config.setLdapPort( port );
            config.setName( DEFAULT_ADMIN );
            config.setCredentials( DEFAULT_PASSWORD );
            PoolableLdapConnectionFactory factory = new PoolableLdapConnectionFactory( config );
            LdapConnectionPool pool = new LdapConnectionPool( factory );
            pool.setTestOnBorrow( true );
            pools.put( port, pool );
        }
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.