Search in sources :

Example 6 with SimpleCustomProperty

use of org.xdi.model.SimpleCustomProperty in project oxAuth by GluuFederation.

the class ExternalApplicationSessionService method executeExternalEndSessionMethod.

public boolean executeExternalEndSessionMethod(CustomScriptConfiguration customScriptConfiguration, HttpServletRequest httpRequest, SessionState sessionState) {
    try {
        log.debug("Executing python 'endSession' method");
        ApplicationSessionType applicationSessionType = (ApplicationSessionType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return applicationSessionType.endSession(httpRequest, sessionState, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return false;
}
Also used : ApplicationSessionType(org.xdi.model.custom.script.type.session.ApplicationSessionType) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty)

Example 7 with SimpleCustomProperty

use of org.xdi.model.SimpleCustomProperty in project oxAuth by GluuFederation.

the class ExternalDynamicClientRegistrationService method executeExternalUpdateClientMethod.

public boolean executeExternalUpdateClientMethod(CustomScriptConfiguration customScriptConfiguration, RegisterRequest registerRequest, Client client) {
    try {
        log.debug("Executing python 'updateClient' method");
        ClientRegistrationType externalClientRegistrationType = (ClientRegistrationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalClientRegistrationType.updateClient(registerRequest, client, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return false;
}
Also used : SimpleCustomProperty(org.xdi.model.SimpleCustomProperty) ClientRegistrationType(org.xdi.model.custom.script.type.client.ClientRegistrationType)

Example 8 with SimpleCustomProperty

use of org.xdi.model.SimpleCustomProperty in project oxAuth by GluuFederation.

the class ExternalDynamicScopeService method executeExternalUpdateMethod.

public boolean executeExternalUpdateMethod(CustomScriptConfiguration customScriptConfiguration, DynamicScopeExternalContext dynamicScopeContext) {
    try {
        log.debug("Executing python 'update' method");
        DynamicScopeType dynamicScopeType = (DynamicScopeType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return dynamicScopeType.update(dynamicScopeContext, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return false;
}
Also used : DynamicScopeType(org.xdi.model.custom.script.type.scope.DynamicScopeType) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty)

Example 9 with SimpleCustomProperty

use of org.xdi.model.SimpleCustomProperty in project oxAuth by GluuFederation.

the class ExternalIdGeneratorService method executeExternalGenerateIdMethod.

public String executeExternalGenerateIdMethod(CustomScriptConfiguration customScriptConfiguration, String appId, String idType, String idPrefix) {
    try {
        log.debug("Executing python 'generateId' method");
        IdGeneratorType externalType = (IdGeneratorType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalType.generateId(appId, idType, idPrefix, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return null;
}
Also used : IdGeneratorType(org.xdi.model.custom.script.type.id.IdGeneratorType) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty)

Example 10 with SimpleCustomProperty

use of org.xdi.model.SimpleCustomProperty in project oxAuth by GluuFederation.

the class LdapCustomAuthenticationConfigurationService method mapCustomAuthentication.

private CustomAuthenticationConfiguration mapCustomAuthentication(oxIDPAuthConf 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(org.xdi.model.config.CustomAuthenticationConfiguration) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty) CustomProperty(org.xdi.oxauth.model.config.CustomProperty) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty) AuthenticationScriptUsageType(org.xdi.model.AuthenticationScriptUsageType)

Aggregations

SimpleCustomProperty (org.xdi.model.SimpleCustomProperty)41 PersonAuthenticationType (org.xdi.model.custom.script.type.auth.PersonAuthenticationType)10 InternalDefaultPersonAuthenticationType (org.xdi.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType)10 ScimType (org.xdi.model.custom.script.type.scim.ScimType)6 CustomScript (org.xdi.model.custom.script.model.CustomScript)4 UpdateUserType (org.xdi.model.custom.script.type.user.UpdateUserType)4 UserRegistrationType (org.xdi.model.custom.script.type.user.UserRegistrationType)4 AuthenticationCustomScript (org.xdi.model.custom.script.model.auth.AuthenticationCustomScript)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 AuthenticationScriptUsageType (org.xdi.model.AuthenticationScriptUsageType)2 CustomScriptConfiguration (org.xdi.model.custom.script.conf.CustomScriptConfiguration)2 BaseExternalType (org.xdi.model.custom.script.type.BaseExternalType)2 IdGeneratorType (org.xdi.model.custom.script.type.id.IdGeneratorType)2 File (java.io.File)1 FileFilter (java.io.FileFilter)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 List (java.util.List)1 Entry (java.util.Map.Entry)1