org.wso2.balana.finder.impl
Class SelectorModule

java.lang.Object
  extended by org.wso2.balana.finder.AttributeFinderModule
      extended by org.wso2.balana.finder.impl.SelectorModule

public class SelectorModule
extends AttributeFinderModule

This module implements the basic behavior of the AttributeSelectorType, looking for attribute values in the physical request document using the given XPath expression. This is implemented as a separate module (instead of being implemented directly in AttributeSelector so that programmers can remove this functionality if they want (it's optional in the spec), so they can replace this code with more efficient, specific code as needed, and so they can easily swap in different XPath libraries.

Note that if no matches are found, this module will return an empty bag (unless some error occurred). The AttributeSelector is still deciding what to return to the policy based on the MustBePresent attribute.

This module uses the Xalan XPath implementation, and supports only version 1.0 of XPath. It is a fully functional, correct implementation of XACML's AttributeSelector functionality, but is not designed for environments that make significant use of XPath queries. Developers for any such environment should consider implementing their own module.

Since:
1.0
Author:
Seth Proctor

Constructor Summary
SelectorModule()
           
 
Method Summary
 EvaluationResult findAttribute(String contextPath, URI attributeType, String contextSelector, Node root, EvaluationCtx context, String xpathVersion)
          Tries to find attribute values based on the given selector data.
 boolean isSelectorSupported()
          Returns true since this module supports retrieving attributes based on the data provided in an AttributeSelectorType.
 
Methods inherited from class org.wso2.balana.finder.AttributeFinderModule
findAttribute, getIdentifier, getSupportedCategories, getSupportedIds, invalidateCache, isDesignatorSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectorModule

public SelectorModule()
Method Detail

isSelectorSupported

public boolean isSelectorSupported()
Returns true since this module supports retrieving attributes based on the data provided in an AttributeSelectorType.

Overrides:
isSelectorSupported in class AttributeFinderModule
Returns:
true

findAttribute

public EvaluationResult findAttribute(String contextPath,
                                      URI attributeType,
                                      String contextSelector,
                                      Node root,
                                      EvaluationCtx context,
                                      String xpathVersion)
Description copied from class: AttributeFinderModule
Tries to find attribute values based on the given selector data. The result, if successful, must always contain a BagAttribute, even if only one value was found. If no values were found, but no other error occurred, an empty bag is returned. This method may need to invoke the context data to look for other attribute values, so a module writer must take care not to create a scenario that loops forever.

Overrides:
findAttribute in class AttributeFinderModule
Parameters:
contextPath - the XPath expression to search against
attributeType - the datatype of the attributes to find
contextSelector - the selector to find the context to apply XPath expression if this is null, applied for default content. This is only used with XACML 3.0
root - the DOM node that XPath evaluation is done. this only used by XACML 3.0 this can be null, if other XACML versions are used.
context - the representation of the request data
xpathVersion - the XPath version to use
Returns:
the result of attribute retrieval, which will be a bag of attributes or an error


Copyright © 2015 WSO2. All rights reserved.