Search in sources :

Example 26 with SimpleCustomProperty

use of io.jans.model.SimpleCustomProperty in project jans by JanssenProject.

the class ExternalScimService method executeScimDeleteUserMethod.

private boolean executeScimDeleteUserMethod(ScimCustomPerson user, CustomScriptConfiguration customScriptConfiguration) {
    try {
        log.debug("Executing python 'SCIM Delete User' method");
        ScimType externalType = (ScimType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        boolean result = externalType.deleteUser(user, configurationAttributes);
        log.debug("executeScimDeleteUserMethod result = " + result);
        return result;
    } catch (Exception e) {
        logAndSave(customScriptConfiguration, e);
    }
    return false;
}
Also used : ScimType(io.jans.model.custom.script.type.scim.ScimType) SimpleCustomProperty(io.jans.model.SimpleCustomProperty)

Example 27 with SimpleCustomProperty

use of io.jans.model.SimpleCustomProperty in project jans by JanssenProject.

the class LdapCustomAuthenticationConfigurationService method mapCustomAuthentication.

private CustomAuthenticationConfiguration mapCustomAuthentication(IDPAuthConf oneConf) {
    CustomAuthenticationConfiguration customAuthenticationConfig = new CustomAuthenticationConfiguration();
    customAuthenticationConfig.setName(oneConf.getName());
    customAuthenticationConfig.setLevel(oneConf.getLevel());
    customAuthenticationConfig.setPriority(oneConf.getPriority());
    customAuthenticationConfig.setEnabled(oneConf.getEnabled());
    customAuthenticationConfig.setVersion(oneConf.getVersion());
    for (CustomProperty customProperty : oneConf.getFields()) {
        if ((customProperty.getValues() == null) || (customProperty.getValues().size() == 0)) {
            continue;
        }
        String attrName = StringHelper.toLowerCase(customProperty.getName());
        if (StringHelper.isEmpty(attrName)) {
            continue;
        }
        String value = customProperty.getValues().get(0);
        if (attrName.startsWith(CUSTOM_AUTHENTICATION_PROPERTY_PREFIX)) {
            String key = customProperty.getName().substring(CUSTOM_AUTHENTICATION_PROPERTY_PREFIX.length());
            SimpleCustomProperty property = new SimpleCustomProperty(key, value);
            customAuthenticationConfig.getCustomAuthenticationAttributes().add(property);
        } else if (StringHelper.equalsIgnoreCase(attrName, CUSTOM_AUTHENTICATION_SCRIPT_PROPERTY_NAME)) {
            customAuthenticationConfig.setCustomAuthenticationScript(value);
        } else if (StringHelper.equalsIgnoreCase(attrName, CUSTOM_AUTHENTICATION_SCRIPT_USAGE_TYPE)) {
            if (StringHelper.isNotEmpty(value)) {
                AuthenticationScriptUsageType authenticationScriptUsageType = AuthenticationScriptUsageType.getByValue(value);
                customAuthenticationConfig.setUsageType(authenticationScriptUsageType);
            }
        }
    }
    return customAuthenticationConfig;
}
Also used : CustomAuthenticationConfiguration(io.jans.model.config.CustomAuthenticationConfiguration) SimpleCustomProperty(io.jans.model.SimpleCustomProperty) CustomProperty(io.jans.as.persistence.model.configuration.CustomProperty) SimpleCustomProperty(io.jans.model.SimpleCustomProperty) AuthenticationScriptUsageType(io.jans.model.AuthenticationScriptUsageType)

Example 28 with SimpleCustomProperty

use of io.jans.model.SimpleCustomProperty in project jans by JanssenProject.

the class ExternalAuthenticationService method executeExternalLogout.

public boolean executeExternalLogout(CustomScriptConfiguration customScriptConfiguration, Map<String, String[]> requestParameters) {
    try {
        log.trace("Executing python 'logout' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.logout(configurationAttributes, requestParameters);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : InternalDefaultPersonAuthenticationType(io.jans.as.server.service.external.internal.InternalDefaultPersonAuthenticationType) PersonAuthenticationType(io.jans.model.custom.script.type.auth.PersonAuthenticationType) SimpleCustomProperty(io.jans.model.SimpleCustomProperty)

Example 29 with SimpleCustomProperty

use of io.jans.model.SimpleCustomProperty in project jans by JanssenProject.

the class ExternalAuthenticationService method getNextStep.

public int getNextStep(CustomScriptConfiguration customScriptConfiguration, Map<String, String[]> requestParameters, int step) {
    try {
        log.trace("Executing python 'getNextStep' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.getNextStep(configurationAttributes, requestParameters, step);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return -1;
}
Also used : InternalDefaultPersonAuthenticationType(io.jans.as.server.service.external.internal.InternalDefaultPersonAuthenticationType) PersonAuthenticationType(io.jans.model.custom.script.type.auth.PersonAuthenticationType) SimpleCustomProperty(io.jans.model.SimpleCustomProperty)

Example 30 with SimpleCustomProperty

use of io.jans.model.SimpleCustomProperty in project jans by JanssenProject.

the class ExternalAuthenticationService method executeExternalGetPageForStep.

public String executeExternalGetPageForStep(CustomScriptConfiguration customScriptConfiguration, int step) {
    try {
        log.trace("Executing python 'getPageForStep' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.getPageForStep(configurationAttributes, step);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
        return null;
    }
}
Also used : InternalDefaultPersonAuthenticationType(io.jans.as.server.service.external.internal.InternalDefaultPersonAuthenticationType) PersonAuthenticationType(io.jans.model.custom.script.type.auth.PersonAuthenticationType) SimpleCustomProperty(io.jans.model.SimpleCustomProperty)

Aggregations

SimpleCustomProperty (io.jans.model.SimpleCustomProperty)46 ScimType (io.jans.model.custom.script.type.scim.ScimType)18 InternalDefaultPersonAuthenticationType (io.jans.as.server.service.external.internal.InternalDefaultPersonAuthenticationType)10 PersonAuthenticationType (io.jans.model.custom.script.type.auth.PersonAuthenticationType)10 CustomScriptConfiguration (io.jans.model.custom.script.conf.CustomScriptConfiguration)3 AuthenticationScriptUsageType (io.jans.model.AuthenticationScriptUsageType)2 BaseExternalType (io.jans.model.custom.script.type.BaseExternalType)2 IdGeneratorType (io.jans.model.custom.script.type.id.IdGeneratorType)2 IdpType (io.jans.model.custom.script.type.idp.IdpType)2 PersistenceType (io.jans.model.custom.script.type.persistence.PersistenceType)2 DynamicScopeType (io.jans.model.custom.script.type.scope.DynamicScopeType)2 ApplicationSessionType (io.jans.model.custom.script.type.session.ApplicationSessionType)2 Response (jakarta.ws.rs.core.Response)2 CustomProperty (io.jans.as.persistence.model.configuration.CustomProperty)1 SimpleExtendedCustomProperty (io.jans.model.SimpleExtendedCustomProperty)1 CustomAuthenticationConfiguration (io.jans.model.config.CustomAuthenticationConfiguration)1 CustomScript (io.jans.model.custom.script.model.CustomScript)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1