Examples of LdapConnectionConfig


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

        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

    private static LdapConnectionPool getAdminPool( LdapServer ldapServer )
    {
        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

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

    try {
      u = new java.net.URI(endpoint.getEndpointUrl());
    } catch (URISyntaxException e) {
      throw new DataRetrievalException("Invalid enpooint URI", e);
    }
    LdapConnectionConfig config = new LdapConnectionConfig();
    config.setLdapHost(u.getHost());
    config.setLdapPort(u.getPort() > 0 ? u.getPort() : 389);
    if (endpoint.hasProperty("loginDN")) {
      config.setName(endpoint.getProperty("loginDN"));
    }
    if (endpoint.hasProperty("loginPW")) {
      config.setName(endpoint.getProperty("loginPW"));
    }
        LdapNetworkConnection connection = new LdapNetworkConnection(config);
        try {
      connection.bind();
    } catch (Exception e) {
View Full Code Here

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

        try {
            u = new java.net.URI(endpoint.getEndpointUrl());
        } catch (URISyntaxException e) {
            throw new DataRetrievalException("Invalid enpooint URI", e);
        }
        LdapConnectionConfig config = new LdapConnectionConfig();
        config.setLdapHost(u.getHost());
        config.setLdapPort(u.getPort() > 0 ? u.getPort() : 389);
        if (endpoint.hasProperty("loginDN")) {
            config.setName(endpoint.getProperty("loginDN"));
        }
        if (endpoint.hasProperty("loginPW")) {
            config.setName(endpoint.getProperty("loginPW"));
        }
        LdapNetworkConnection connection = new LdapNetworkConnection(config);
        try {
            connection.bind();
        } catch (Exception e) {
View Full Code Here

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

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

    try {
      u = new java.net.URI(endpoint.getEndpointUrl());
    } catch (URISyntaxException e) {
      throw new DataRetrievalException("Invalid enpooint URI", e);
    }
    LdapConnectionConfig config = new LdapConnectionConfig();
    config.setLdapHost(u.getHost());
    config.setLdapPort(u.getPort() > 0 ? u.getPort() : 389);
    if (endpoint.hasProperty("loginDN")) {
      config.setName(endpoint.getProperty("loginDN"));
    }
    if (endpoint.hasProperty("loginPW")) {
      config.setName(endpoint.getProperty("loginPW"));
    }
        LdapNetworkConnection connection = new LdapNetworkConnection(config);
        try {
      connection.bind();
    } catch (Exception e) {
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.