protected LdapNetworkConnection openLdapConnection(LdapSettings ldapSettings) throws LdapException { final LdapConnectionConfig config = new LdapConnectionConfig(); config.setLdapHost(ldapSettings.getUri().getHost()); config.setLdapPort(ldapSettings.getUri().getPort()); config.setUseSsl(ldapSettings.getUri().getScheme().startsWith("ldaps")); config.setUseTls(ldapSettings.isUseStartTls()); if (ldapSettings.isTrustAllCertificates()) { config.setTrustManagers(new TrustAllX509TrustManager()); } config.setName(ldapSettings.getSystemUserName()); config.setCredentials(ldapSettings.getSystemPassword()); return ldapConnector.connect(config); }
config.setName(ldapSettings.getSystemUserName()); config.setCredentials(ldapSettings.getSystemPassword());
config.setName(request.systemUsername());
public LdapConnectionConfig getLdapConnectionConfig() { if (ldapConfiguration == null) { ldapConfiguration = new LdapConnectionConfig(); ldapConfiguration.setLdapHost(ldapConnectionConfig.get("ldapHost")); ldapConfiguration.setLdapPort(Integer.parseInt(ldapConnectionConfig.get("ldapPort"))); ldapConfiguration.setName(ldapConnectionConfig.get("name")); ldapConfiguration.setCredentials(ldapConnectionConfig.get("credentials")); } return ldapConfiguration; }
private static LdapConnectionPool createConnectionPool(LDAPConfiguration configuration) throws IOException { final LdapConnectionConfig config = new LdapConnectionConfig(); config.setLdapHost(configuration.getHostname()); config.setLdapPort(configuration.getPort()); config.setName(configuration.getBindDn()); config.setCredentials(configuration.getBindPassword()); final DefaultPoolableLdapConnectionFactory factory = new DefaultPoolableLdapConnectionFactory(config); final LdapConnectionPool pool = new LdapConnectionPool(factory); pool.setTestOnBorrow(configuration.isPoolTestOnBorrow()); pool.setTestOnReturn(configuration.isPoolTestOnReturn()); pool.setTestWhileIdle(configuration.isPoolTestWhileIdle()); pool.setMaxActive(configuration.getPoolMaxActive()); pool.setMaxIdle(configuration.getPoolMaxIdle()); pool.setMinIdle(configuration.getPoolMinIdle()); pool.setMaxWait(configuration.getPoolMaxWait()); switch (configuration.getPoolWhenExhaustedAction()) { case BLOCK: pool.setWhenExhaustedAction(LdapConnectionPool.WHEN_EXHAUSTED_BLOCK); break; case FAIL: pool.setWhenExhaustedAction(LdapConnectionPool.WHEN_EXHAUSTED_FAIL); break; case GROW: pool.setWhenExhaustedAction(LdapConnectionPool.WHEN_EXHAUSTED_GROW); break; default: pool.setWhenExhaustedAction(LdapConnectionPool.DEFAULT_WHEN_EXHAUSTED_ACTION); } return pool; }
/** * Gets the admin pool. * * @param ldapServer the ldap server * @return the admin pool */ private static LdapConnectionPool getAdminPool( LdapServer ldapServer ) { int port = ldapServer.getPort(); if ( !POOLS.containsKey( port ) ) { LdapConnectionConfig config = new LdapConnectionConfig(); config.setLdapHost( Network.LOOPBACK_HOSTNAME ); config.setLdapPort( port ); config.setName( DEFAULT_ADMIN ); config.setCredentials( DEFAULT_PASSWORD ); DefaultPoolableLdapConnectionFactory factory = new DefaultPoolableLdapConnectionFactory( config ); LdapConnectionPool pool = new LdapConnectionPool( factory ); pool.setTestOnBorrow( true ); POOLS.put( port, pool ); } return POOLS.get( port ); }
protected LdapNetworkConnection openLdapConnection(LdapSettings ldapSettings) throws LdapException { final LdapConnectionConfig config = new LdapConnectionConfig(); config.setLdapHost(ldapSettings.getUri().getHost()); config.setLdapPort(ldapSettings.getUri().getPort()); config.setUseSsl(ldapSettings.getUri().getScheme().startsWith("ldaps")); config.setUseTls(ldapSettings.isUseStartTls()); if (ldapSettings.isTrustAllCertificates()) { config.setTrustManagers(new TrustAllX509TrustManager()); } config.setName(ldapSettings.getSystemUserName()); config.setCredentials(ldapSettings.getSystemPassword()); return ldapConnector.connect(config); }
config.setName(ldapSettings.getSystemUserName()); config.setCredentials(ldapSettings.getSystemPassword());
@Override public void load() { config = new LdapConnectionConfig(); if (host != null) config.setLdapHost(host); if (port != null) config.setLdapPort(port); if (username != null) config.setName(username); if (password != null) config.setCredentials(password); if (usePool != null && usePool) { ValidatingPoolableLdapConnectionFactory factory = new ValidatingPoolableLdapConnectionFactory(config); connectionPool = new LdapConnectionPool(factory); connectionPool.setTestOnBorrow(true); } else connectionPool = null; }
config.setName(request.systemUsername()); config.setCredentials(request.systemPassword());
config.setName( "uid=admin,ou=system" ); config.setCredentials( "secret" );
String bindDN = config.getBindDN(); if (bindDN != null && !bindDN.isEmpty()) { cc.setName(bindDN); cc.setCredentials(config.getBindPassword());
config.setLdapHost( host ); config.setLdapPort( port ); config.setName( Config.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_UID, "" ) ); logConfig.setLdapHost( host ); logConfig.setLdapPort( port ); logConfig.setName( Config.getInstance().getProperty( GlobalIds.LDAP_ADMIN_POOL_UID, "" ) ); logConfig.setName( Config.getInstance().getProperty( GlobalIds.LDAP_LOG_POOL_UID, "" ) ); String logPw; if ( EncryptUtil.isEnabled() )
private static LdapConnectionPool createConnectionPool(LDAPConfiguration configuration) throws IOException { final LdapConnectionConfig config = new LdapConnectionConfig(); config.setLdapHost(configuration.getHostname()); config.setLdapPort(configuration.getPort()); config.setName(configuration.getBindDn()); config.setCredentials(configuration.getBindPassword()); final DefaultPoolableLdapConnectionFactory factory = new DefaultPoolableLdapConnectionFactory(config); final LdapConnectionPool pool = new LdapConnectionPool(factory); pool.setTestOnBorrow(configuration.isPoolTestOnBorrow()); pool.setTestOnReturn(configuration.isPoolTestOnReturn()); pool.setTestWhileIdle(configuration.isPoolTestWhileIdle()); pool.setMaxActive(configuration.getPoolMaxActive()); pool.setMaxIdle(configuration.getPoolMaxIdle()); pool.setMinIdle(configuration.getPoolMinIdle()); pool.setMaxWait(configuration.getPoolMaxWait()); switch (configuration.getPoolWhenExhaustedAction()) { case BLOCK: pool.setWhenExhaustedAction(LdapConnectionPool.WHEN_EXHAUSTED_BLOCK); break; case FAIL: pool.setWhenExhaustedAction(LdapConnectionPool.WHEN_EXHAUSTED_FAIL); break; case GROW: pool.setWhenExhaustedAction(LdapConnectionPool.WHEN_EXHAUSTED_GROW); break; default: pool.setWhenExhaustedAction(LdapConnectionPool.DEFAULT_WHEN_EXHAUSTED_ACTION); } return pool; }