Search in sources :

Example 6 with SimpleCustomProperty

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

the class ExternalAuthenticationService method getInternalCustomScriptConfiguration.

private CustomScriptConfiguration getInternalCustomScriptConfiguration() {
    CustomScript customScript = new AuthenticationCustomScript() {

        @Override
        public AuthenticationScriptUsageType getUsageType() {
            return AuthenticationScriptUsageType.INTERACTIVE;
        }
    };
    customScript.setName(OxConstants.SCRIPT_TYPE_INTERNAL_RESERVED_NAME);
    customScript.setLevel(-1);
    customScript.setInternal(true);
    CustomScriptConfiguration customScriptConfiguration = new CustomScriptConfiguration(customScript, internalDefaultPersonAuthenticationType, new HashMap<String, SimpleCustomProperty>(0));
    return customScriptConfiguration;
}
Also used : CustomScript(org.gluu.model.custom.script.model.CustomScript) AuthenticationCustomScript(org.gluu.model.custom.script.model.auth.AuthenticationCustomScript) AuthenticationCustomScript(org.gluu.model.custom.script.model.auth.AuthenticationCustomScript) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty) CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Example 7 with SimpleCustomProperty

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

the class ExternalDynamicScopeService method executeExternalUpdateMethod.

public boolean executeExternalUpdateMethod(CustomScriptConfiguration customScriptConfiguration, DynamicScopeExternalContext dynamicScopeContext) {
    try {
        log.trace("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);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : DynamicScopeType(org.gluu.model.custom.script.type.scope.DynamicScopeType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Example 8 with SimpleCustomProperty

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

the class ExternalDynamicScopeService method executeExternalGetSupportedClaimsMethod.

public List<String> executeExternalGetSupportedClaimsMethod(CustomScriptConfiguration customScriptConfiguration) {
    int apiVersion = executeExternalGetApiVersion(customScriptConfiguration);
    if (apiVersion > 1) {
        try {
            log.trace("Executing python 'get supported claims' method");
            DynamicScopeType dynamicScopeType = (DynamicScopeType) customScriptConfiguration.getExternalType();
            Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
            return dynamicScopeType.getSupportedClaims(configurationAttributes);
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
            saveScriptError(customScriptConfiguration.getCustomScript(), ex);
        }
    }
    return null;
}
Also used : DynamicScopeType(org.gluu.model.custom.script.type.scope.DynamicScopeType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Example 9 with SimpleCustomProperty

use of org.gluu.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.trace("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);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return null;
}
Also used : IdGeneratorType(org.gluu.model.custom.script.type.id.IdGeneratorType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Example 10 with SimpleCustomProperty

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

the class ExternalDynamicClientRegistrationService method executeExternalCreateClientMethod.

public boolean executeExternalCreateClientMethod(CustomScriptConfiguration customScriptConfiguration, RegisterRequest registerRequest, Client client) {
    try {
        log.trace("Executing python 'createClient' method");
        ClientRegistrationType externalClientRegistrationType = (ClientRegistrationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalClientRegistrationType.createClient(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)

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