Search in sources :

Example 1 with GluuConfiguration

use of io.jans.as.persistence.model.configuration.GluuConfiguration in project jans by JanssenProject.

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(io.jans.model.SmtpConfiguration) GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration) Produces(javax.enterprise.inject.Produces) RequestScoped(javax.enterprise.context.RequestScoped)

Example 2 with GluuConfiguration

use of io.jans.as.persistence.model.configuration.GluuConfiguration in project jans by JanssenProject.

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, "jansDbAuth", "jansAuthMode");
    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(io.jans.orm.PersistenceEntryManager) ApplicationInitializedEvent(io.jans.service.cdi.event.ApplicationInitializedEvent) CustomScriptType(io.jans.model.custom.script.CustomScriptType) GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration)

Example 3 with GluuConfiguration

use of io.jans.as.persistence.model.configuration.GluuConfiguration in project jans by JanssenProject.

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(io.jans.orm.exception.BasePersistenceException) GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration)

Example 4 with GluuConfiguration

use of io.jans.as.persistence.model.configuration.GluuConfiguration in project jans by JanssenProject.

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, "jansDbAuth", "jansAuthMode");
    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(io.jans.orm.PersistenceEntryManager) GluuConfiguration(io.jans.as.persistence.model.configuration.GluuConfiguration) GluuLdapConfiguration(io.jans.model.ldap.GluuLdapConfiguration)

Example 5 with GluuConfiguration

use of io.jans.as.persistence.model.configuration.GluuConfiguration in project jans by JanssenProject.

the class LdapCustomAuthenticationConfigurationService method getCustomAuthenticationConfigurations.

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

Aggregations

GluuConfiguration (io.jans.as.persistence.model.configuration.GluuConfiguration)16 ProtectedApi (io.jans.configapi.core.rest.ProtectedApi)5 IDPAuthConf (io.jans.as.persistence.model.configuration.IDPAuthConf)3 JacksonUtils (com.github.fge.jackson.JacksonUtils)2 Lists (com.google.common.collect.Lists)2 EncryptionService (io.jans.as.common.service.common.EncryptionService)2 SmtpConfiguration (io.jans.model.SmtpConfiguration)2 PersistenceEntryManager (io.jans.orm.PersistenceEntryManager)2 StringEncrypter (io.jans.util.security.StringEncrypter)2 List (java.util.List)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 ApplicationScoped (javax.enterprise.context.ApplicationScoped)2 Inject (javax.inject.Inject)2 StringUtils (org.apache.commons.lang3.StringUtils)2 AuthenticationMethod (io.jans.configapi.rest.model.AuthenticationMethod)1 CustomAuthenticationConfiguration (io.jans.model.config.CustomAuthenticationConfiguration)1 CustomScriptType (io.jans.model.custom.script.CustomScriptType)1 GluuLdapConfiguration (io.jans.model.ldap.GluuLdapConfiguration)1 CouchbaseConnectionConfiguration (io.jans.orm.couchbase.model.CouchbaseConnectionConfiguration)1