eu.xtreemos.xosd.security.vops.xacml.utils
Class VopsPDP

java.lang.Object
  extended by eu.xtreemos.xosd.security.vops.xacml.utils.VopsPDP

public class VopsPDP
extends java.lang.Object


Field Summary
private  com.sun.xacml.finder.AttributeFinder attributeFinder
           
private  java.util.List attributeModules
           
private  com.sun.xacml.finder.impl.CurrentEnvModule envAttributeModule
           
(package private) static org.apache.log4j.Logger logger
           
private  com.sun.xacml.PDP pdp
           
private static java.lang.String POLICY_FILE
           
private static java.lang.String POLICY_FILE_2
           
private  VOPSPolicyFinder policyFinder
           
private  java.util.Set policyModules
           
private static java.lang.String REQUEST_FILE
           
private  com.sun.xacml.finder.impl.SelectorModule selectorAttributeModule
           
private  XmlPolicyModule xmlPolicyModule
           
 
Constructor Summary
VopsPDP()
          Default constructor.
VopsPDP(java.lang.String[] policySources)
          Constructor that takes an array of strings (policies), each of which contains an XACML policy, and sets up a PDP with access to these policies only.
 
Method Summary
 com.sun.xacml.ctx.ResponseCtx evaluate(com.sun.xacml.ctx.RequestCtx request)
           
 com.sun.xacml.ctx.ResponseCtx evaluateFromFile(java.lang.String requestFile)
          Evaluates the given request and returns the Response that the PDP will hand back to the PEP.
 com.sun.xacml.ctx.ResponseCtx evaluateFromRequest(com.sun.xacml.ctx.RequestCtx request)
          Evaluates the given request and returns the Response that the PDP will hand back to the PEP.
 com.sun.xacml.ctx.ResponseCtx evaluateUsingPolicyCombineAlgorithm(com.sun.xacml.ctx.RequestCtx request, com.sun.xacml.combine.PolicyCombiningAlgorithm algorithm)
          Evaluates request using policy combining algorithm.
 com.sun.xacml.finder.AttributeFinder getAttributeFinder()
           
 VOPSPolicyFinder getPolicyFinder()
           
static void main(java.lang.String[] args)
          Main-line driver for this sample code.
static java.lang.String readFile(java.lang.String path)
          Returns content of the file designated by path.
 void setAttributeFinder(com.sun.xacml.finder.AttributeFinder attributeFinder)
           
 void setPolicyFinder(VOPSPolicyFinder policyFinder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static final org.apache.log4j.Logger logger

REQUEST_FILE

private static final java.lang.String REQUEST_FILE
See Also:
Constant Field Values

POLICY_FILE

private static final java.lang.String POLICY_FILE
See Also:
Constant Field Values

POLICY_FILE_2

private static final java.lang.String POLICY_FILE_2
See Also:
Constant Field Values

xmlPolicyModule

private XmlPolicyModule xmlPolicyModule

envAttributeModule

private com.sun.xacml.finder.impl.CurrentEnvModule envAttributeModule

selectorAttributeModule

private com.sun.xacml.finder.impl.SelectorModule selectorAttributeModule

attributeFinder

private com.sun.xacml.finder.AttributeFinder attributeFinder

attributeModules

private java.util.List attributeModules

policyFinder

private VOPSPolicyFinder policyFinder

policyModules

private java.util.Set policyModules

pdp

private com.sun.xacml.PDP pdp
Constructor Detail

VopsPDP

public VopsPDP()
        throws java.lang.Exception
Default constructor. This creates a SimplePDP with a PDP based on the configuration defined by the runtime property com.sun.xcaml.PDPConfigFile.

Throws:
java.lang.Exception

VopsPDP

public VopsPDP(java.lang.String[] policySources)
        throws java.lang.Exception
Constructor that takes an array of strings (policies), each of which contains an XACML policy, and sets up a PDP with access to these policies only. The PDP is configured programatically to have only a few specific modules.

Parameters:
policyFiles - an array of filenames that specify policies
Throws:
java.lang.Exception
Method Detail

evaluateFromFile

public com.sun.xacml.ctx.ResponseCtx evaluateFromFile(java.lang.String requestFile)
                                               throws java.io.IOException,
                                                      com.sun.xacml.ParsingException
Evaluates the given request and returns the Response that the PDP will hand back to the PEP.

Parameters:
requestFile - the name of a file that contains a Request
Returns:
the result of the evaluation
Throws:
java.io.IOException - if there is a problem accessing the file
com.sun.xacml.ParsingException - if the Request is invalid

evaluateFromRequest

public com.sun.xacml.ctx.ResponseCtx evaluateFromRequest(com.sun.xacml.ctx.RequestCtx request)
                                                  throws java.io.IOException,
                                                         com.sun.xacml.ParsingException
Evaluates the given request and returns the Response that the PDP will hand back to the PEP.

Parameters:
requestFile - the name of a file that contains a Request
Returns:
the result of the evaluation
Throws:
java.io.IOException - if there is a problem accessing the file
com.sun.xacml.ParsingException - if the Request is invalid

evaluate

public com.sun.xacml.ctx.ResponseCtx evaluate(com.sun.xacml.ctx.RequestCtx request)

evaluateUsingPolicyCombineAlgorithm

public com.sun.xacml.ctx.ResponseCtx evaluateUsingPolicyCombineAlgorithm(com.sun.xacml.ctx.RequestCtx request,
                                                                         com.sun.xacml.combine.PolicyCombiningAlgorithm algorithm)
                                                                  throws java.lang.Exception
Evaluates request using policy combining algorithm. Difference from this#evaluate(RequestCtx) is that this evaluation takes into account all policies using combining algorithm.

Parameters:
request - to be evaluated
algorithm - to be used in evaluation
Returns:
instance of ResponseCtx
Throws:
java.lang.Exception

readFile

public static java.lang.String readFile(java.lang.String path)
Returns content of the file designated by path.

Parameters:
path - to file
Returns:
content of the file in string presentation.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main-line driver for this sample code. This method lets you invoke the PDP directly from the command-line.

Parameters:
args - the input arguments to the class. They are either the flag "-config" followed by a request file, or a request file followed by one or more policy files. In the case that the configuration flag is used, the configuration file must be specified in the standard java property, com.sun.xacml.PDPConfigFile.
Throws:
java.lang.Exception

getAttributeFinder

public com.sun.xacml.finder.AttributeFinder getAttributeFinder()

setAttributeFinder

public void setAttributeFinder(com.sun.xacml.finder.AttributeFinder attributeFinder)

getPolicyFinder

public VOPSPolicyFinder getPolicyFinder()

setPolicyFinder

public void setPolicyFinder(VOPSPolicyFinder policyFinder)