Search in sources :

Example 1 with EncryptionService

use of org.gluu.oxauth.service.common.EncryptionService 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 EncryptionService

use of org.gluu.oxauth.service.common.EncryptionService 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)2 FileConfiguration (org.gluu.orm.util.properties.FileConfiguration)2 EncryptionService (org.gluu.oxauth.service.common.EncryptionService)2 PersistenceConfiguration (org.gluu.persist.model.PersistenceConfiguration)1