use of org.gluu.model.custom.script.conf.CustomScriptConfiguration 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.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.
the class ExternalDynamicScopeService method executeExternalGetSupportedClaimsMethods.
public List<String> executeExternalGetSupportedClaimsMethods(List<Scope> dynamicScope) {
DynamicScopeExternalContext context = new DynamicScopeExternalContext(dynamicScope, null, null);
Set<String> result = new HashSet<String>();
for (CustomScriptConfiguration customScriptConfiguration : getScriptsToExecute(context)) {
List<String> scriptResult = executeExternalGetSupportedClaimsMethod(customScriptConfiguration);
if (scriptResult != null) {
result.addAll(scriptResult);
}
}
return new ArrayList<String>(result);
}
use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.
the class ExternalPostAuthnService method externalForceReAuthentication.
public boolean externalForceReAuthentication(Client client, ExternalPostAuthnContext context) {
final List<CustomScriptConfiguration> scripts = getCustomScriptConfigurationsByDns(client.getAttributes().getPostAuthnScripts());
if (scripts.isEmpty()) {
return false;
}
log.trace("Found {} post-authn scripts.", scripts.size());
for (CustomScriptConfiguration script : scripts) {
if (!externalForceReAuthentication(script, context)) {
return false;
}
}
log.debug("Forcing re-authentication via post-authn script.");
return true;
}
use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.
the class ExternalSpontaneousScopeService method executeExternalManipulateScope.
public void executeExternalManipulateScope(SpontaneousScopeExternalContext context) {
for (CustomScriptConfiguration script : getScriptsToExecute(context.getClient())) {
executeExternalManipulateScope(script, context);
log.debug("GrantedScopes {} after execution of interception script {}.", context.getGrantedScopes(), script.getName());
}
}
use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.
the class ExternalUmaClaimsGatheringService method determineScript.
public CustomScriptConfiguration determineScript(String[] scriptNames) {
log.trace("Trying to determine claims-gathering script, scriptNames: {} ...", Arrays.toString(scriptNames));
List<CustomScriptConfiguration> scripts = new ArrayList<CustomScriptConfiguration>();
for (String scriptName : scriptNames) {
CustomScriptConfiguration script = getCustomScriptConfigurationByName(scriptName);
if (script != null) {
scripts.add(script);
} else {
log.error("Failed to load claims-gathering script with name: {}", scriptName);
}
}
if (scripts.isEmpty()) {
return null;
}
CustomScriptConfiguration highestPriority = Collections.max(scripts, new Comparator<CustomScriptConfiguration>() {
@Override
public int compare(CustomScriptConfiguration o1, CustomScriptConfiguration o2) {
return Integer.compare(o1.getLevel(), o2.getLevel());
}
});
log.trace("Determined claims-gathering script successfully. Name: {}, inum: {}", highestPriority.getName(), highestPriority.getInum());
return highestPriority;
}
Aggregations