Search in sources :

Example 1 with GluuConfiguration

use of org.oxauth.persistence.model.configuration.GluuConfiguration in project oxAuth by GluuFederation.

the class ApplicationFactory method getSmtpConfiguration.

@Produces
@RequestScoped
public SmtpConfiguration getSmtpConfiguration() {
    GluuConfiguration configuration = configurationService.getConfiguration();
    SmtpConfiguration smtpConfiguration = configuration.getSmtpConfiguration();
    if (smtpConfiguration == null) {
        return new SmtpConfiguration();
    }
    configurationService.decryptSmtpPassword(smtpConfiguration);
    return smtpConfiguration;
}
Also used : SmtpConfiguration(org.gluu.model.SmtpConfiguration) GluuConfiguration(org.oxauth.persistence.model.configuration.GluuConfiguration) Produces(javax.enterprise.inject.Produces) RequestScoped(javax.enterprise.context.RequestScoped)

Example 2 with GluuConfiguration

use of org.oxauth.persistence.model.configuration.GluuConfiguration in project oxAuth by GluuFederation.

the class AppInitializer method reloadConfiguration.

private void reloadConfiguration() {
    PersistenceEntryManager localPersistenceEntryManager = persistenceEntryManagerInstance.get();
    log.trace("Attempting to use {}: {}", ApplicationFactory.PERSISTENCE_ENTRY_MANAGER_NAME, localPersistenceEntryManager.getOperationService());
    GluuConfiguration newConfiguration = loadConfiguration(localPersistenceEntryManager, "oxIDPAuthentication", "oxAuthenticationMode");
    List<GluuLdapConfiguration> newPersistenceAuthConfigs = loadPersistenceAuthConfigs(newConfiguration);
    if (!this.persistenceAuthConfigs.equals(newPersistenceAuthConfigs)) {
        recreatePersistenceAuthEntryManagers(newPersistenceAuthConfigs);
        this.persistenceAuthConfigs = newPersistenceAuthConfigs;
        event.select(ReloadAuthScript.Literal.INSTANCE).fire(ExternalAuthenticationService.MODIFIED_INTERNAL_TYPES_EVENT_TYPE);
    }
    setDefaultAuthenticationMethod(newConfiguration);
}
Also used : PersistenceEntryManager(org.gluu.persist.PersistenceEntryManager) GluuConfiguration(org.oxauth.persistence.model.configuration.GluuConfiguration) GluuLdapConfiguration(org.gluu.model.ldap.GluuLdapConfiguration)

Example 3 with GluuConfiguration

use of org.oxauth.persistence.model.configuration.GluuConfiguration in project oxAuth by GluuFederation.

the class AppInitializer method loadConfiguration.

private GluuConfiguration loadConfiguration(PersistenceEntryManager localPersistenceEntryManager, String... persistenceReturnAttributes) {
    String configurationDn = configurationFactory.getBaseDn().getConfiguration();
    if (StringHelper.isEmpty(configurationDn)) {
        return null;
    }
    GluuConfiguration configuration = null;
    try {
        configuration = localPersistenceEntryManager.find(configurationDn, GluuConfiguration.class, persistenceReturnAttributes);
    } catch (BasePersistenceException ex) {
        log.error("Failed to load global configuration entry from Ldap", ex);
        return null;
    }
    return configuration;
}
Also used : BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) GluuConfiguration(org.oxauth.persistence.model.configuration.GluuConfiguration)

Example 4 with GluuConfiguration

use of org.oxauth.persistence.model.configuration.GluuConfiguration in project oxAuth by GluuFederation.

the class AppInitializer method applicationInitialized.

public void applicationInitialized(@Observes @Initialized(ApplicationScoped.class) Object init) {
    log.debug("Initializing application services");
    configurationFactory.create();
    PersistenceEntryManager localPersistenceEntryManager = persistenceEntryManagerInstance.get();
    log.trace("Attempting to use {}: {}", ApplicationFactory.PERSISTENCE_ENTRY_MANAGER_NAME, localPersistenceEntryManager.getOperationService());
    GluuConfiguration newConfiguration = loadConfiguration(localPersistenceEntryManager, "oxIDPAuthentication", "oxAuthenticationMode");
    this.persistenceAuthConfigs = loadPersistenceAuthConfigs(newConfiguration);
    // Initialize python interpreter
    pythonService.initPythonInterpreter(configurationFactory.getBaseConfiguration().getString("pythonModulesDir", null));
    // Initialize script manager
    List<CustomScriptType> supportedCustomScriptTypes = Lists.newArrayList(CustomScriptType.values());
    supportedCustomScriptTypes.remove(CustomScriptType.CACHE_REFRESH);
    supportedCustomScriptTypes.remove(CustomScriptType.UPDATE_USER);
    supportedCustomScriptTypes.remove(CustomScriptType.USER_REGISTRATION);
    supportedCustomScriptTypes.remove(CustomScriptType.SCIM);
    supportedCustomScriptTypes.remove(CustomScriptType.IDP);
    statService.init();
    // Start timer
    initSchedulerService();
    // Schedule timer tasks
    metricService.initTimer();
    configurationFactory.initTimer();
    loggerService.initTimer();
    ldapStatusTimer.initTimer();
    cleanerTimer.initTimer();
    customScriptManager.initTimer(supportedCustomScriptTypes);
    keyGeneratorTimer.initTimer();
    statTimer.initTimer();
    expirationNotificatorTimer.initTimer();
    initTimer();
    initCibaRequestsProcessor();
    // Set default authentication method after
    setDefaultAuthenticationMethod(newConfiguration);
    // Notify plugins about finish application initialization
    eventApplicationInitialized.select(ApplicationInitialized.Literal.APPLICATION).fire(new ApplicationInitializedEvent());
}
Also used : PersistenceEntryManager(org.gluu.persist.PersistenceEntryManager) ApplicationInitializedEvent(org.gluu.service.cdi.event.ApplicationInitializedEvent) CustomScriptType(org.gluu.model.custom.script.CustomScriptType) GluuConfiguration(org.oxauth.persistence.model.configuration.GluuConfiguration)

Example 5 with GluuConfiguration

use of org.oxauth.persistence.model.configuration.GluuConfiguration in project oxAuth by GluuFederation.

the class LdapCustomAuthenticationConfigurationService method getCustomAuthenticationConfigurations.

public List<CustomAuthenticationConfiguration> getCustomAuthenticationConfigurations() {
    GluuConfiguration gluuConfiguration = configurationService.getConfiguration();
    List<oxIDPAuthConf> authConfigurations = gluuConfiguration.getOxIDPAuthentication();
    List<CustomAuthenticationConfiguration> customAuthenticationConfigurations = new ArrayList<CustomAuthenticationConfiguration>();
    if (authConfigurations == null) {
        return customAuthenticationConfigurations;
    }
    for (oxIDPAuthConf authConfiguration : authConfigurations) {
        if (authConfiguration.getEnabled() && authConfiguration.getType().equalsIgnoreCase("customAuthentication")) {
            CustomAuthenticationConfiguration customAuthenticationConfiguration = mapCustomAuthentication(authConfiguration);
            customAuthenticationConfigurations.add(customAuthenticationConfiguration);
        }
    }
    return customAuthenticationConfigurations;
}
Also used : CustomAuthenticationConfiguration(org.gluu.model.config.CustomAuthenticationConfiguration) ArrayList(java.util.ArrayList) org.oxauth.persistence.model.configuration.oxIDPAuthConf(org.oxauth.persistence.model.configuration.oxIDPAuthConf) GluuConfiguration(org.oxauth.persistence.model.configuration.GluuConfiguration)

Aggregations

GluuConfiguration (org.oxauth.persistence.model.configuration.GluuConfiguration)5 PersistenceEntryManager (org.gluu.persist.PersistenceEntryManager)2 ArrayList (java.util.ArrayList)1 RequestScoped (javax.enterprise.context.RequestScoped)1 Produces (javax.enterprise.inject.Produces)1 SmtpConfiguration (org.gluu.model.SmtpConfiguration)1 CustomAuthenticationConfiguration (org.gluu.model.config.CustomAuthenticationConfiguration)1 CustomScriptType (org.gluu.model.custom.script.CustomScriptType)1 GluuLdapConfiguration (org.gluu.model.ldap.GluuLdapConfiguration)1 BasePersistenceException (org.gluu.persist.exception.BasePersistenceException)1 ApplicationInitializedEvent (org.gluu.service.cdi.event.ApplicationInitializedEvent)1 org.oxauth.persistence.model.configuration.oxIDPAuthConf (org.oxauth.persistence.model.configuration.oxIDPAuthConf)1