Search in sources :

Example 6 with LDAPConnectionProvider

use of org.gluu.site.ldap.LDAPConnectionProvider in project oxAuth by GluuFederation.

the class Manual method init.

@BeforeClass
public void init() {
    final FileConfiguration fileConfiguration = new FileConfiguration(LDAP_FILE_PATH);
    final Properties props = PropertiesDecrypter.decryptProperties(fileConfiguration.getProperties(), "passoword");
    final LDAPConnectionProvider connectionProvider = new LDAPConnectionProvider(props);
    MANAGER = new LdapEntryManager(new OperationsFacade(connectionProvider));
}
Also used : FileConfiguration(org.xdi.util.properties.FileConfiguration) LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) OperationsFacade(org.gluu.site.ldap.OperationsFacade) Properties(java.util.Properties) LDAPConnectionProvider(org.gluu.site.ldap.LDAPConnectionProvider) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with LDAPConnectionProvider

use of org.gluu.site.ldap.LDAPConnectionProvider in project oxCore by GluuFederation.

the class LdapSampleEntryManager method createLdapEntryManager.

public LdapEntryManager createLdapEntryManager() {
    Properties connectionProperties = getSampleConnectionProperties();
    LDAPConnectionProvider connectionProvider = createConnectionProvider(connectionProperties);
    Properties bindConnectionProperties = prepareBindConnectionProperties(connectionProperties);
    LDAPConnectionProvider bindConnectionProvider = createBindConnectionProvider(bindConnectionProperties, connectionProperties);
    LdapEntryManager ldapEntryManager = new LdapEntryManager(new OperationsFacade(connectionProvider, bindConnectionProvider));
    log.debug("Created LdapEntryManager: " + ldapEntryManager);
    return ldapEntryManager;
}
Also used : LdapEntryManager(org.gluu.site.ldap.persistence.LdapEntryManager) OperationsFacade(org.gluu.site.ldap.OperationsFacade) Properties(java.util.Properties) LDAPConnectionProvider(org.gluu.site.ldap.LDAPConnectionProvider)

Example 8 with LDAPConnectionProvider

use of org.gluu.site.ldap.LDAPConnectionProvider in project oxTrust by GluuFederation.

the class CacheRefreshTimer method prepareLdapServerConnection.

private LdapServerConnection prepareLdapServerConnection(CacheRefreshConfiguration cacheRefreshConfiguration, GluuLdapConfiguration ldapConfiguration, boolean useLocalConnection) {
    String ldapConfig = ldapConfiguration.getConfigId();
    if (useLocalConnection) {
        return new LdapServerConnection(ldapConfig, ldapEntryManager, getBaseDNs(ldapConfiguration));
    }
    Properties ldapProperties = toLdapProperties(ldapConfiguration);
    LDAPConnectionProvider ldapConnectionProvider = new LDAPConnectionProvider(encryptionService.decryptProperties(ldapProperties));
    if (!ldapConnectionProvider.isConnected()) {
        log.error("Failed to connect to LDAP server using configuration {}", ldapConfig);
        return null;
    }
    return new LdapServerConnection(ldapConfig, ldapConnectionProvider, getBaseDNs(ldapConfiguration));
}
Also used : Properties(java.util.Properties) LDAPConnectionProvider(org.gluu.site.ldap.LDAPConnectionProvider)

Aggregations

LDAPConnectionProvider (org.gluu.site.ldap.LDAPConnectionProvider)8 Properties (java.util.Properties)5 OperationsFacade (org.gluu.site.ldap.OperationsFacade)3 LdapEntryManager (org.gluu.site.ldap.persistence.LdapEntryManager)3 FileConfiguration (org.xdi.util.properties.FileConfiguration)2 IOException (java.io.IOException)1 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)1 JsonParseException (org.codehaus.jackson.JsonParseException)1 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)1 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)1 BeforeClass (org.testng.annotations.BeforeClass)1 EncryptionException (org.xdi.util.security.StringEncrypter.EncryptionException)1