JBoss port of sunxacml 2.0.5-redhat-1

org.jboss.security.xacml.sunxacml.support
Class SimplePDP

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.support.SimplePDP

public class SimplePDP
extends Object

This is a simple, command-line driven XACML PDP. It acts both as an example of how to write a full-featured PDP and as a sample program that lets you evaluate requests against policies. See the comments for the main() method for correct usage.

As of the 2.0 release, this has been moved into the new support tree of the codebase. It has also been updated to use several of the new finder modules provided in the support tree codebase, so that static and dynamic references are supported, policies can be loaded from URLs, top-level policies are wrapped in a policy set when more than one applies, etc.

If you don't use a configuration file, then the default modules can all optionally support schema validation. To turn this on, provide the filename of the schema file in the property "com.sun.xacml.PolicySchema". You can also turn this on if you use a configuration file and it includes the modules provided in the support package.

Since:
1.1
Author:
Seth Proctor

Constructor Summary
SimplePDP()
          Default constructor.
SimplePDP(String[] policies)
          Constructor that takes an array of filenames and URLs, each of which points to an XACML policy, and sets up a PDP with access to these policies only.
 
Method Summary
 ResponseCtx evaluate(String requestFile)
          Evaluates the given request and returns the Response that the PDP will hand back to the PEP.
static void main(String[] args)
          Main-line driver for this sample code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePDP

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

Throws:
Exception

SimplePDP

public SimplePDP(String[] policies)
          throws Exception
Constructor that takes an array of filenames and URLs, each of which points to an XACML policy, and sets up a PDP with access to these policies only. These policies may be accessed based on context matching or by reference (based on their policy identifiers). The PDP is also setup to support dynamic URL references.

Parameters:
policies - an arry of filenames and URLs that specify policies
Throws:
Exception
Method Detail

evaluate

public ResponseCtx evaluate(String requestFile)
                     throws IOException,
                            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:
IOException - if there is a problem accessing the file
ParsingException - if the Request is invalid

main

public static void main(String[] args)
                 throws 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:
Exception

JBoss port of sunxacml 2.0.5-redhat-1

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.