use of org.gluu.site.ldap.LDAPConnectionProvider in project oxAuth by GluuFederation.
the class LdapStatusTimer method logConnectionProviderStatistic.
public void logConnectionProviderStatistic(LdapEntryManager ldapEntryManager, String connectionProviderName, String bindConnectionProviderName) {
LDAPConnectionProvider ldapConnectionProvider = ldapEntryManager.getLdapOperationService().getConnectionProvider();
LDAPConnectionProvider bindLdapConnectionProvider = ldapEntryManager.getLdapOperationService().getBindConnectionProvider();
if (ldapConnectionProvider == null) {
log.error("{} is empty", connectionProviderName);
} else {
if (ldapConnectionProvider.getConnectionPool() == null) {
log.error("{} is empty", connectionProviderName);
} else {
log.info("{} statistics: {}", connectionProviderName, ldapConnectionProvider.getConnectionPool().getConnectionPoolStatistics());
}
}
if (bindLdapConnectionProvider == null) {
log.error("{} is empty", bindConnectionProviderName);
} else {
if (bindLdapConnectionProvider.getConnectionPool() == null) {
log.error("{} is empty", bindConnectionProviderName);
} else {
log.info("{} statistics: {}", bindConnectionProviderName, bindLdapConnectionProvider.getConnectionPool().getConnectionPoolStatistics());
}
}
}
use of org.gluu.site.ldap.LDAPConnectionProvider in project oxCore by GluuFederation.
the class LdapSampleEntryManager method createBindConnectionProvider.
private LDAPConnectionProvider createBindConnectionProvider(Properties bindConnectionProperties, Properties connectionProperties) {
LDAPConnectionProvider bindConnectionProvider = createConnectionProvider(bindConnectionProperties);
if (ResultCode.INAPPROPRIATE_AUTHENTICATION.equals(bindConnectionProvider.getCreationResultCode())) {
log.warn("It's not possible to create authentication LDAP connection pool using anonymous bind. Attempting to create it using binDN/bindPassword");
bindConnectionProvider = createConnectionProvider(connectionProperties);
}
return bindConnectionProvider;
}
use of org.gluu.site.ldap.LDAPConnectionProvider in project oxTrust by GluuFederation.
the class ManagePersonAuthenticationAction method testLdapConnection.
public String testLdapConnection() {
try {
FileConfiguration configuration = new FileConfiguration(ConfigurationFactory.LDAP_PROPERTIES_FILE);
if (!configuration.isLoaded()) {
configuration = new FileConfiguration(ConfigurationFactory.LDAP_DEFAULT_PROPERTIES_FILE);
}
Properties properties = configuration.getProperties();
properties.setProperty("bindDN", this.ldapConfig.getBindDN());
properties.setProperty("bindPassword", this.ldapConfig.getBindPassword());
properties.setProperty("servers", buildServersString(this.ldapConfig.getServers()));
properties.setProperty("useSSL", Boolean.toString(this.ldapConfig.isUseSSL()));
LDAPConnectionProvider connectionProvider = new LDAPConnectionProvider(PropertiesDecrypter.decryptProperties(properties, configurationFactory.getCryptoConfigurationSalt()));
if (connectionProvider.isConnected()) {
connectionProvider.closeConnectionPool();
return OxTrustConstants.RESULT_SUCCESS;
}
connectionProvider.closeConnectionPool();
return OxTrustConstants.RESULT_FAILURE;
} catch (Exception ex) {
log.error("Could not connect to LDAP", ex);
return OxTrustConstants.RESULT_FAILURE;
}
}
use of org.gluu.site.ldap.LDAPConnectionProvider in project oxTrust by GluuFederation.
the class Configuration method createLdapEntryManager.
private LdapEntryManager createLdapEntryManager() {
Properties connectionProperties = (Properties) this.ldapConfiguration.getProperties();
Properties decryptedConnectionProperties = PropertiesDecrypter.decryptProperties(connectionProperties, this.cryptoConfigurationSalt);
LDAPConnectionProvider connectionProvider = new LDAPConnectionProvider(decryptedConnectionProperties);
LdapEntryManager ldapEntryManager = new LdapEntryManager(new OperationsFacade(connectionProvider, null));
logger.debug("Created LdapEntryManager: {}", ldapEntryManager);
return ldapEntryManager;
}
use of org.gluu.site.ldap.LDAPConnectionProvider in project oxTrust by GluuFederation.
the class LdapStatusTimer method logConnectionProviderStatistic.
public void logConnectionProviderStatistic(LdapEntryManager ldapEntryManager, String connectionProviderName, String bindConnectionProviderName) {
LDAPConnectionProvider ldapConnectionProvider = ldapEntryManager.getLdapOperationService().getConnectionProvider();
LDAPConnectionProvider bindLdapConnectionProvider = ldapEntryManager.getLdapOperationService().getBindConnectionProvider();
if (ldapConnectionProvider == null) {
log.error("{} is empty", connectionProviderName);
} else {
if (ldapConnectionProvider.getConnectionPool() == null) {
log.error("{} is empty", connectionProviderName);
} else {
log.info("{} statistics: {}", connectionProviderName, ldapConnectionProvider.getConnectionPool().getConnectionPoolStatistics());
}
}
if (bindLdapConnectionProvider == null) {
log.error("{} is empty", bindConnectionProviderName);
} else {
if (bindLdapConnectionProvider.getConnectionPool() == null) {
log.error("{} is empty", bindConnectionProviderName);
} else {
log.info("{} statistics: {}", bindConnectionProviderName, bindLdapConnectionProvider.getConnectionPool().getConnectionPoolStatistics());
}
}
}
Aggregations