edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.match.basic
Class ScriptMatchFunctor

java.lang.Object
  extended by edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.match.basic.AbstractMatchFunctor
      extended by edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.match.basic.ScriptMatchFunctor
All Implemented Interfaces:
MatchFunctor

public class ScriptMatchFunctor
extends AbstractMatchFunctor

Match function based on a JSR-268 script.


Field Summary
private  CompiledScript compiledScript
          The compiled form of the script, if the script engine supports compiling.
private  org.slf4j.Logger log
          Class logger.
private  String script
          The script to execute.
private  ScriptEngine scriptEngine
          The script engine to execute the script.
private  String scriptLanguage
          The scripting language.
 
Constructor Summary
ScriptMatchFunctor(String language, String newScript)
          Constructor.
 
Method Summary
protected  void compileScript()
          Compiles the script if the scripting engine supports it.
protected  boolean doEvaluatePolicyRequirement(ShibbolethFilteringContext filterContext)
          Evaluates this matching criteria.
protected  boolean doEvaluateValue(ShibbolethFilteringContext filterContext, String attributeId, Object attributeValue)
          Evaluates this matching criteria.
protected  Boolean executeScript(ScriptContext scriptContext)
          Executes the functor's script.
protected  ScriptContext getScriptContext(ShibbolethFilteringContext filterContext, String attributeId, Object attributeValue)
          Creates the script execution context from the resolution context.
 
Methods inherited from class edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.match.basic.AbstractMatchFunctor
evaluateDenyRule, evaluatePermitValue, evaluatePolicyRequirement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private final org.slf4j.Logger log
Class logger.


scriptLanguage

private String scriptLanguage
The scripting language.


script

private String script
The script to execute.


scriptEngine

private ScriptEngine scriptEngine
The script engine to execute the script.


compiledScript

private CompiledScript compiledScript
The compiled form of the script, if the script engine supports compiling.

Constructor Detail

ScriptMatchFunctor

public ScriptMatchFunctor(String language,
                          String newScript)
Constructor.

Parameters:
language - the scripting language
newScript - the script to execute
Method Detail

doEvaluateValue

protected boolean doEvaluateValue(ShibbolethFilteringContext filterContext,
                                  String attributeId,
                                  Object attributeValue)
                           throws FilterProcessingException
Evaluates this matching criteria. This evaluation is used while the filtering engine is evaluating either a deny or permit value rule.

Specified by:
doEvaluateValue in class AbstractMatchFunctor
Parameters:
filterContext - the current filtering context
attributeId - ID of the attribute being evaluated
attributeValue - value of the attribute being evaluated
Returns:
true if the criteria for this matching function are meant
Throws:
FilterProcessingException - thrown if the function can not be evaluated

doEvaluatePolicyRequirement

protected boolean doEvaluatePolicyRequirement(ShibbolethFilteringContext filterContext)
                                       throws FilterProcessingException
Evaluates this matching criteria. This evaluation is used while the filtering engine determines policy applicability.

Specified by:
doEvaluatePolicyRequirement in class AbstractMatchFunctor
Parameters:
filterContext - current filtering context
Returns:
true if the criteria for this matching function are meant
Throws:
FilterProcessingException - thrown if the function can not be evaluated

compileScript

protected void compileScript()
Compiles the script if the scripting engine supports it.


getScriptContext

protected ScriptContext getScriptContext(ShibbolethFilteringContext filterContext,
                                         String attributeId,
                                         Object attributeValue)
Creates the script execution context from the resolution context.

Parameters:
filterContext - current resolution context
attributeId - ID of the attribute currently being evaluted
attributeValue - attribute currently being validated
Returns:
constructed script context

executeScript

protected Boolean executeScript(ScriptContext scriptContext)
                         throws FilterProcessingException
Executes the functor's script.

Parameters:
scriptContext - the script execution context
Returns:
the result of the script
Throws:
FilterProcessingException - thrown if there is a problem evaluating the script


Copyright © 1999-2012. All Rights Reserved.