Search in sources :

Example 11 with SimpleCustomProperty

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

the class ExternalDynamicClientRegistrationService method executeExternalUpdateClientMethod.

public boolean executeExternalUpdateClientMethod(CustomScriptConfiguration customScriptConfiguration, RegisterRequest registerRequest, Client client) {
    try {
        log.trace("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);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : SimpleCustomProperty(org.gluu.model.SimpleCustomProperty) ClientRegistrationType(org.gluu.model.custom.script.type.client.ClientRegistrationType)

Example 12 with SimpleCustomProperty

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

the class ExternalApplicationSessionService method executeExternalStartSessionMethod.

public boolean executeExternalStartSessionMethod(CustomScriptConfiguration customScriptConfiguration, HttpServletRequest httpRequest, SessionId sessionId) {
    try {
        log.trace("Executing python 'startSession' method");
        ApplicationSessionType applicationSessionType = (ApplicationSessionType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return applicationSessionType.startSession(httpRequest, sessionId, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : ApplicationSessionType(org.gluu.model.custom.script.type.session.ApplicationSessionType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Example 13 with SimpleCustomProperty

use of org.gluu.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.gluu.model.config.CustomAuthenticationConfiguration) CustomProperty(org.oxauth.persistence.model.configuration.CustomProperty) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty) AuthenticationScriptUsageType(org.gluu.model.AuthenticationScriptUsageType)

Example 14 with SimpleCustomProperty

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

the class ExternalAuthenticationService method executeExternalIsValidAuthenticationMethod.

private boolean executeExternalIsValidAuthenticationMethod(AuthenticationScriptUsageType usageType, CustomScriptConfiguration customScriptConfiguration) {
    try {
        log.debug("Executing python 'isValidAuthenticationMethod' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.isValidAuthenticationMethod(usageType, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : PersonAuthenticationType(org.gluu.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.gluu.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Example 15 with SimpleCustomProperty

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

the class ExternalAuthenticationService method executeExternalGetAlternativeAuthenticationMethod.

private String executeExternalGetAlternativeAuthenticationMethod(AuthenticationScriptUsageType usageType, CustomScriptConfiguration customScriptConfiguration) {
    try {
        log.trace("Executing python 'getAlternativeAuthenticationMethod' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.getAlternativeAuthenticationMethod(usageType, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return null;
}
Also used : PersonAuthenticationType(org.gluu.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.gluu.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Aggregations

SimpleCustomProperty (org.gluu.model.SimpleCustomProperty)19 PersonAuthenticationType (org.gluu.model.custom.script.type.auth.PersonAuthenticationType)10 InternalDefaultPersonAuthenticationType (org.gluu.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType)10 ClientRegistrationType (org.gluu.model.custom.script.type.client.ClientRegistrationType)2 DynamicScopeType (org.gluu.model.custom.script.type.scope.DynamicScopeType)2 ApplicationSessionType (org.gluu.model.custom.script.type.session.ApplicationSessionType)2 AuthenticationScriptUsageType (org.gluu.model.AuthenticationScriptUsageType)1 CustomAuthenticationConfiguration (org.gluu.model.config.CustomAuthenticationConfiguration)1 CustomScriptConfiguration (org.gluu.model.custom.script.conf.CustomScriptConfiguration)1 CustomScript (org.gluu.model.custom.script.model.CustomScript)1 AuthenticationCustomScript (org.gluu.model.custom.script.model.auth.AuthenticationCustomScript)1 IdGeneratorType (org.gluu.model.custom.script.type.id.IdGeneratorType)1 CustomProperty (org.oxauth.persistence.model.configuration.CustomProperty)1