Search in sources :

Example 1 with ConfigurationException

use of io.jans.exception.ConfigurationException in project jans by JanssenProject.

the class ConfigurationFactory method getCorsConfiguration.

@Produces
@ApplicationScoped
public CorsConfiguration getCorsConfiguration() {
    try {
        if (this.corsConfigurationFilter != null) {
            CorsConfiguration corsConfiguration = new CorsConfiguration();
            corsConfiguration.parseAndStore(this.corsConfigurationFilter.getCorsEnabled().toString(), this.corsConfigurationFilter.getCorsAllowedOrigins(), this.corsConfigurationFilter.getCorsAllowedMethods(), this.corsConfigurationFilter.getCorsAllowedHeaders(), this.corsConfigurationFilter.getCorsExposedHeaders(), this.corsConfigurationFilter.getCorsSupportCredentials().toString(), Long.toString(this.corsConfigurationFilter.getCorsPreflightMaxAge()), this.corsConfigurationFilter.getCorsRequestDecorate().toString());
            log.debug("Initializing CorsConfiguration:{} ", corsConfiguration);
            return corsConfiguration;
        }
    } catch (Exception ex) {
        throw new ConfigurationException("Failed to initialize  CorsConfiguration" + corsConfigurationFilter);
    }
    return null;
}
Also used : CorsConfiguration(io.jans.configapi.model.configuration.CorsConfiguration) ConfigurationException(io.jans.exception.ConfigurationException) BasePersistenceException(io.jans.orm.exception.BasePersistenceException) OxIntializationException(io.jans.exception.OxIntializationException) ConfigurationException(io.jans.exception.ConfigurationException) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Example 2 with ConfigurationException

use of io.jans.exception.ConfigurationException in project jans by JanssenProject.

the class ConfigurationFactory method loadCryptoConfigurationSalt.

private void loadCryptoConfigurationSalt() {
    try {
        FileConfiguration cryptoConfiguration = createFileConfiguration(saltFilePath);
        this.cryptoConfigurationSalt = cryptoConfiguration.getString("encodeSalt");
    } catch (Exception ex) {
        if (log.isErrorEnabled())
            log.error("Failed to load configuration from {}", saltFilePath, ex);
        throw new ConfigurationException("Failed to load configuration from " + saltFilePath, ex);
    }
}
Also used : FileConfiguration(io.jans.orm.util.properties.FileConfiguration) ConfigurationException(io.jans.exception.ConfigurationException) BasePersistenceException(io.jans.orm.exception.BasePersistenceException) OxIntializationException(io.jans.exception.OxIntializationException) ConfigurationException(io.jans.exception.ConfigurationException)

Example 3 with ConfigurationException

use of io.jans.exception.ConfigurationException in project jans by JanssenProject.

the class ConfigurationFactory method loadCryptoConfigurationSalt.

public void loadCryptoConfigurationSalt() {
    try {
        FileConfiguration cryptoConfiguration = createFileConfiguration(saltFilePath, true);
        this.cryptoConfigurationSalt = cryptoConfiguration.getString("encodeSalt");
    } catch (Exception ex) {
        if (log.isErrorEnabled())
            log.error("Failed to load configuration from {}", saltFilePath, ex);
        throw new ConfigurationException("Failed to load configuration from " + saltFilePath, ex);
    }
}
Also used : FileConfiguration(io.jans.util.properties.FileConfiguration) ConfigurationException(io.jans.exception.ConfigurationException) ConfigurationException(io.jans.exception.ConfigurationException) BasePersistenceException(io.jans.orm.exception.BasePersistenceException)

Example 4 with ConfigurationException

use of io.jans.exception.ConfigurationException in project jans by JanssenProject.

the class ClientApiPersistenceEntryManagerFactory method createPersistenceEntryManager.

public final PersistenceEntryManager createPersistenceEntryManager(Properties properties, String persistenceType) {
    try {
        PersistenceEntryManagerFactory persistenceEntryManagerFactory = this.standalonePersistanceFactoryService.getPersistenceEntryManagerFactory(persistenceType);
        if (persistenceEntryManagerFactory.getPersistenceType().equalsIgnoreCase("couchbase")) {
            ((CouchbaseEntryManagerFactory) persistenceEntryManagerFactory).create();
        }
        Properties connProps = createConnectionProperties(properties, persistenceEntryManagerFactory.getPersistenceType());
        PersistenceEntryManager ret = persistenceEntryManagerFactory.createEntryManager(connProps);
        if (ret == null)
            throw new RuntimeException("Could not create persistence entry manager");
        return ret;
    } catch (ConfigurationException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
Also used : CouchbaseEntryManagerFactory(io.jans.orm.couchbase.impl.CouchbaseEntryManagerFactory) PersistenceEntryManager(io.jans.orm.PersistenceEntryManager) ConfigurationException(io.jans.exception.ConfigurationException) PersistenceEntryManagerFactory(io.jans.orm.PersistenceEntryManagerFactory) Properties(java.util.Properties)

Example 5 with ConfigurationException

use of io.jans.exception.ConfigurationException in project jans by JanssenProject.

the class ConfigurationFactory method loadCryptoConfigurationSalt.

public void loadCryptoConfigurationSalt() {
    try {
        FileConfiguration cryptoConfiguration = createFileConfiguration(saltFilePath, true);
        this.cryptoConfigurationSalt = cryptoConfiguration.getString("encodeSalt");
    } catch (Exception ex) {
        log.error("Failed to load configuration from {}", saltFilePath, ex);
        throw new ConfigurationException("Failed to load configuration from " + saltFilePath, ex);
    }
}
Also used : FileConfiguration(io.jans.util.properties.FileConfiguration) ConfigurationException(io.jans.exception.ConfigurationException) BasePersistenceException(io.jans.orm.exception.BasePersistenceException) ConfigurationException(io.jans.exception.ConfigurationException)

Aggregations

ConfigurationException (io.jans.exception.ConfigurationException)10 BasePersistenceException (io.jans.orm.exception.BasePersistenceException)8 OxIntializationException (io.jans.exception.OxIntializationException)3 FileConfiguration (io.jans.util.properties.FileConfiguration)3 Properties (java.util.Properties)3 CorsConfiguration (io.jans.configapi.model.configuration.CorsConfiguration)2 PersistenceEntryManager (io.jans.orm.PersistenceEntryManager)2 FileConfiguration (io.jans.orm.util.properties.FileConfiguration)2 ApplicationFactory (io.jans.as.common.service.common.ApplicationFactory)1 Conf (io.jans.as.model.config.Conf)1 Constants (io.jans.as.model.config.Constants)1 StaticConfiguration (io.jans.as.model.config.StaticConfiguration)1 WebKeysConfiguration (io.jans.as.model.config.WebKeysConfiguration)1 AppConfiguration (io.jans.as.model.configuration.AppConfiguration)1 Configuration (io.jans.as.model.configuration.Configuration)1 ErrorResponseFactory (io.jans.as.model.error.ErrorResponseFactory)1 SecurityProviderUtility (io.jans.as.model.util.SecurityProviderUtility)1 ApiAppConfiguration (io.jans.configapi.model.configuration.ApiAppConfiguration)1 ApiConf (io.jans.configapi.model.configuration.ApiConf)1 CorsConfigurationFilter (io.jans.configapi.model.configuration.CorsConfigurationFilter)1