use of org.gluu.model.custom.script.model.CustomScript in project oxAuth by GluuFederation.
the class IdGenServiceTest method buildIdCustomScriptEntry.
private CustomScript buildIdCustomScriptEntry(String idScript) {
String customScriptId = UUID.randomUUID().toString();
String dn = customScriptService.buildDn(customScriptId);
CustomScript customScript = new CustomScript();
customScript.setDn(dn);
customScript.setInum(customScriptId);
customScript.setProgrammingLanguage(ProgrammingLanguage.PYTHON);
customScript.setScriptType(CustomScriptType.ID_GENERATOR);
customScript.setScript(idScript);
customScript.setName("test_id");
customScript.setLevel(0);
customScript.setEnabled(true);
customScript.setRevision(1);
return customScript;
}
use of org.gluu.model.custom.script.model.CustomScript in project oxAuth by GluuFederation.
the class ExternalAuthenticationService method buildScriptAliases.
private HashMap<String, String> buildScriptAliases() {
HashMap<String, String> newScriptAliases = new HashMap<String, String>();
for (Entry<String, CustomScriptConfiguration> script : customScriptConfigurationsNameMap.entrySet()) {
String name = script.getKey();
CustomScript customScript = script.getValue().getCustomScript();
newScriptAliases.put(name, name);
List<String> aliases = customScript.getAliases();
if (aliases != null) {
for (String alias : aliases) {
if (StringUtils.isNotBlank(alias)) {
newScriptAliases.put(alias, name);
}
}
}
}
return newScriptAliases;
}
use of org.gluu.model.custom.script.model.CustomScript 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;
}
use of org.gluu.model.custom.script.model.CustomScript in project oxCore by GluuFederation.
the class AbstractCustomScriptService method findCustomScripts.
public List<CustomScript> findCustomScripts(List<CustomScriptType> customScriptTypes, String... returnAttributes) {
String baseDn = baseDn();
if ((customScriptTypes == null) || (customScriptTypes.size() == 0)) {
return findAllCustomScripts(returnAttributes);
}
List<Filter> customScriptTypeFilters = new ArrayList<Filter>();
for (CustomScriptType customScriptType : customScriptTypes) {
Filter customScriptTypeFilter = Filter.createEqualityFilter("oxScriptType", customScriptType.getValue());
customScriptTypeFilters.add(customScriptTypeFilter);
}
Filter filter = Filter.createORFilter(customScriptTypeFilters);
List<CustomScript> result = persistenceEntryManager.findEntries(baseDn, CustomScript.class, filter, returnAttributes);
return result;
}
use of org.gluu.model.custom.script.model.CustomScript in project oxCore by GluuFederation.
the class AbstractCustomScriptService method getScriptByDisplayName.
public CustomScript getScriptByDisplayName(String name) {
Filter searchFilter = Filter.createEqualityFilter("displayName", name);
List<CustomScript> result = persistenceEntryManager.findEntries(baseDn(), CustomScript.class, searchFilter, 1);
if (result != null && !result.isEmpty()) {
return result.get(0);
}
return null;
}
Aggregations