use of org.gluu.util.exception.ConfigurationException in project oxCore by GluuFederation.
the class ConfigurationFactory method loadCacheConfiguration.
private CacheConfiguration loadCacheConfiguration() {
SharedConfigurationEntry sharedConfigurationEntry = persistenceEntryManager.find(SharedConfigurationEntry.class, SHARED_CONFIGURATION_DN);
if (sharedConfigurationEntry == null) {
LOG.error("Failed to load share configuration from DB. Please fix it!!!.");
throw new ConfigurationException("Failed to load shared configuration from DB.");
}
CacheConfiguration cacheConfiguration = sharedConfigurationEntry.getCacheConfiguration();
if (cacheConfiguration == null || cacheConfiguration.getCacheProviderType() == null) {
LOG.error("Failed to read cache configuration from DB. Please check configuration oxCacheConfiguration attribute " + "that must contain cache configuration JSON represented by CacheConfiguration.class. Shared configuration DN: " + SHARED_CONFIGURATION_DN);
LOG.info("Creating fallback IN-MEMORY cache configuration ... ");
cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setInMemoryConfiguration(new InMemoryConfiguration());
LOG.info("IN-MEMORY cache configuration is created.");
}
LOG.info("Cache configuration: " + cacheConfiguration);
return cacheConfiguration;
}
use of org.gluu.util.exception.ConfigurationException in project oxCore by GluuFederation.
the class ConfigurationFactory method create.
private void create() {
this.persistanceFactoryService = new StandalonePersistanceFactoryService();
this.persistenceConfiguration = persistanceFactoryService.loadPersistenceConfiguration(getDefaultConfigurationFileName());
this.baseConfiguration = loadBaseConfiguration();
this.confDir = confDir();
this.saltFilePath = confDir + SALT_FILE_NAME;
this.cryptoConfigurationSalt = loadCryptoConfigurationSalt();
this.stringEncrypter = createStringEncrypter();
this.persistenceEntryManager = createPersistenceEntryManager();
if (!createFromDb()) {
LOG.error("Failed to load configuration from DB. Please fix it!!!.");
throw new ConfigurationException("Failed to load configuration from DB.");
} else {
this.loaded = true;
LOG.info("Configuration loaded successfully.");
}
this.cacheConfiguration = loadCacheConfiguration();
}
use of org.gluu.util.exception.ConfigurationException 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;
}
use of org.gluu.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class OpenIdClient method initInternal.
protected void initInternal() {
this.clientId = appConfiguration.getOpenIdClientId();
this.clientSecret = appConfiguration.getOpenIdClientPassword();
if (StringHelper.isNotEmpty(this.clientSecret)) {
try {
StringEncrypter stringEncrypter = StringEncrypter.instance(this.configuration.getCryptoConfigurationSalt());
this.clientSecret = stringEncrypter.decrypt(this.clientSecret);
} catch (EncryptionException ex) {
logger.warn("Assuming that client password is not encrypted!");
}
}
this.preRegisteredClient = StringHelper.isNotEmpty(this.clientId) && StringHelper.isNotEmpty(this.clientSecret);
try {
loadOpenIdConfiguration();
} catch (IOException ex) {
throw new ConfigurationException("Failed to load oxAuth configuration");
}
}
use of org.gluu.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class OpenIdService method loadOpenIdConfiguration.
private void loadOpenIdConfiguration() throws IOException {
String openIdProvider = appConfiguration.getOxAuthIssuer();
if (StringHelper.isEmpty(openIdProvider)) {
throw new ConfigurationException("OpenIdProvider Url is invalid");
}
openIdProvider = openIdProvider + "/.well-known/openid-configuration";
final OpenIdConfigurationClient openIdConfigurationClient = new OpenIdConfigurationClient(openIdProvider);
final OpenIdConfigurationResponse response = openIdConfigurationClient.execOpenIdConfiguration();
if ((response == null) || (response.getStatus() != 200)) {
throw new ConfigurationException("Failed to load oxAuth configuration");
}
log.info("Successfully loaded oxAuth configuration");
this.openIdConfiguration = response;
}
Aggregations