Search in sources :

Example 6 with BaseExternalType

use of org.gluu.model.custom.script.type.BaseExternalType 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

BaseExternalType (org.gluu.model.custom.script.type.BaseExternalType)6 IOException (java.io.IOException)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 ArrayList (java.util.ArrayList)2 SimpleCustomProperty (org.gluu.model.SimpleCustomProperty)2 CustomScriptType (org.gluu.model.custom.script.CustomScriptType)2 CustomScriptConfiguration (org.gluu.model.custom.script.conf.CustomScriptConfiguration)2 CustomScript (org.gluu.model.custom.script.model.CustomScript)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1 SimpleExtendedCustomProperty (org.gluu.model.SimpleExtendedCustomProperty)1 AuthenticationCustomScript (org.gluu.model.custom.script.model.auth.AuthenticationCustomScript)1 PyLong (org.python.core.PyLong)1 PyObject (org.python.core.PyObject)1