Search in sources :

Example 11 with CustomScriptType

use of org.gluu.model.custom.script.CustomScriptType 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 12 with CustomScriptType

use of org.gluu.model.custom.script.CustomScriptType in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method getAuthModesByAcrValues.

public List<String> getAuthModesByAcrValues(List<String> acrValues) {
    List<String> authModes = new ArrayList<String>();
    for (String acrValue : acrValues) {
        if (StringHelper.isNotEmpty(acrValue)) {
            String customScriptName = StringHelper.toLowerCase(scriptName(acrValue));
            if (customScriptConfigurationsNameMap.containsKey(customScriptName)) {
                CustomScriptConfiguration customScriptConfiguration = customScriptConfigurationsNameMap.get(customScriptName);
                CustomScript customScript = customScriptConfiguration.getCustomScript();
                // Handle internal authentication method
                if (customScript.isInternal()) {
                    authModes.add(scriptName(acrValue));
                    continue;
                }
                CustomScriptType customScriptType = customScriptConfiguration.getCustomScript().getScriptType();
                BaseExternalType defaultImplementation = customScriptType.getDefaultImplementation();
                BaseExternalType pythonImplementation = customScriptConfiguration.getExternalType();
                if ((pythonImplementation != null) && (defaultImplementation != pythonImplementation)) {
                    authModes.add(scriptName(acrValue));
                }
            }
        }
    }
    return authModes;
}
Also used : CustomScript(org.gluu.model.custom.script.model.CustomScript) AuthenticationCustomScript(org.gluu.model.custom.script.model.auth.AuthenticationCustomScript) CustomScriptType(org.gluu.model.custom.script.CustomScriptType) BaseExternalType(org.gluu.model.custom.script.type.BaseExternalType) ArrayList(java.util.ArrayList) CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Aggregations

CustomScriptType (org.gluu.model.custom.script.CustomScriptType)12 ArrayList (java.util.ArrayList)9 CustomScript (org.gluu.model.custom.script.model.CustomScript)8 List (java.util.List)5 AuthenticationCustomScript (org.gluu.model.custom.script.model.auth.AuthenticationCustomScript)5 SimpleCustomProperty (org.gluu.model.SimpleCustomProperty)2 SimpleExtendedCustomProperty (org.gluu.model.SimpleExtendedCustomProperty)2 CustomScriptConfiguration (org.gluu.model.custom.script.conf.CustomScriptConfiguration)2 BaseExternalType (org.gluu.model.custom.script.type.BaseExternalType)2 PersistenceEntryManager (org.gluu.persist.PersistenceEntryManager)2 ApplicationInitializedEvent (org.gluu.service.cdi.event.ApplicationInitializedEvent)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 HashMap (java.util.HashMap)1 Filter (org.gluu.search.filter.Filter)1 GluuConfiguration (org.oxauth.persistence.model.configuration.GluuConfiguration)1 PyLong (org.python.core.PyLong)1 PyObject (org.python.core.PyObject)1