Search in sources :

Example 1 with FileConfiguration

use of org.gluu.orm.util.properties.FileConfiguration in project oxAuth by GluuFederation.

the class AppInitializer method prepareAuthConnectionProperties.

private Properties prepareAuthConnectionProperties(GluuLdapConfiguration persistenceAuthConfig, String persistenceType) {
    String prefix = persistenceType + "#";
    FileConfiguration configuration = configurationFactory.getPersistenceConfiguration().getConfiguration();
    Properties properties = (Properties) configuration.getProperties().clone();
    if (persistenceAuthConfig != null) {
        properties.setProperty(prefix + "servers", buildServersString(persistenceAuthConfig.getServers()));
        String bindDn = persistenceAuthConfig.getBindDN();
        if (StringHelper.isNotEmpty(bindDn)) {
            properties.setProperty(prefix + "bindDN", bindDn);
            properties.setProperty(prefix + "bindPassword", persistenceAuthConfig.getBindPassword());
        }
        properties.setProperty(prefix + "useSSL", Boolean.toString(persistenceAuthConfig.isUseSSL()));
        properties.setProperty(prefix + "maxconnections", Integer.toString(persistenceAuthConfig.getMaxConnections()));
        // Remove internal DB trustStoreFile property
        properties.remove(prefix + "ssl.trustStoreFile");
        properties.remove(prefix + "ssl.trustStorePin");
        properties.remove(prefix + "ssl.trustStoreFormat");
    }
    EncryptionService securityService = encryptionServiceInstance.get();
    Properties decrypytedProperties = securityService.decryptAllProperties(properties);
    return decrypytedProperties;
}
Also used : FileConfiguration(org.gluu.orm.util.properties.FileConfiguration) EncryptionService(org.gluu.oxauth.service.common.EncryptionService) Properties(java.util.Properties)

Example 2 with FileConfiguration

use of org.gluu.orm.util.properties.FileConfiguration in project oxCore by GluuFederation.

the class ConfigurationFactory method preparePersistanceProperties.

protected Properties preparePersistanceProperties() {
    FileConfiguration persistenceConfig = persistenceConfiguration.getConfiguration();
    Properties connectionProperties = (Properties) persistenceConfig.getProperties();
    Properties decryptedConnectionProperties;
    try {
        decryptedConnectionProperties = PropertiesDecrypter.decryptAllProperties(StringEncrypter.defaultInstance(), connectionProperties, this.cryptoConfigurationSalt);
    } catch (EncryptionException ex) {
        throw new ConfigurationException("Failed to decript configuration properties", ex);
    }
    return decryptedConnectionProperties;
}
Also used : FileConfiguration(org.gluu.orm.util.properties.FileConfiguration) ConfigurationException(org.gluu.util.exception.ConfigurationException) EncryptionException(org.gluu.util.security.StringEncrypter.EncryptionException) Properties(java.util.Properties)

Example 3 with FileConfiguration

use of org.gluu.orm.util.properties.FileConfiguration in project oxTrust by GluuFederation.

the class AppInitializer method preparePersistanceProperties.

protected Properties preparePersistanceProperties() {
    PersistenceConfiguration persistenceConfiguration = this.configurationFactory.getPersistenceConfiguration();
    FileConfiguration persistenceConfig = persistenceConfiguration.getConfiguration();
    Properties connectionProperties = (Properties) persistenceConfig.getProperties();
    EncryptionService securityService = encryptionServiceInstance.get();
    Properties decryptedConnectionProperties = securityService.decryptAllProperties(connectionProperties);
    return decryptedConnectionProperties;
}
Also used : FileConfiguration(org.gluu.orm.util.properties.FileConfiguration) PersistenceConfiguration(org.gluu.persist.model.PersistenceConfiguration) Properties(java.util.Properties)

Example 4 with FileConfiguration

use of org.gluu.orm.util.properties.FileConfiguration in project oxAuth by GluuFederation.

the class AppInitializer method preparePersistanceProperties.

protected Properties preparePersistanceProperties() {
    PersistenceConfiguration persistenceConfiguration = this.configurationFactory.getPersistenceConfiguration();
    FileConfiguration persistenceConfig = persistenceConfiguration.getConfiguration();
    Properties connectionProperties = (Properties) persistenceConfig.getProperties();
    EncryptionService securityService = encryptionServiceInstance.get();
    Properties decryptedConnectionProperties = securityService.decryptAllProperties(connectionProperties);
    return decryptedConnectionProperties;
}
Also used : FileConfiguration(org.gluu.orm.util.properties.FileConfiguration) PersistenceConfiguration(org.gluu.persist.model.PersistenceConfiguration) EncryptionService(org.gluu.oxauth.service.common.EncryptionService) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)4 FileConfiguration (org.gluu.orm.util.properties.FileConfiguration)4 EncryptionService (org.gluu.oxauth.service.common.EncryptionService)2 PersistenceConfiguration (org.gluu.persist.model.PersistenceConfiguration)2 ConfigurationException (org.gluu.util.exception.ConfigurationException)1 EncryptionException (org.gluu.util.security.StringEncrypter.EncryptionException)1