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

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

public class SamplePolicyBuilder
extends java.lang.Object

This is an example program that shows how to build and generate an XACML Policy. This doesn't show all the available features, but it provides a good sample of commonly used functionality. Note that there's a fair amount of duplicate code in this class, since verbosity (in this case) makes the code a little easier to understand. An equivalent Polict to that generated here is found in the policy directory as generated.xml. The generated request can be used with this policy.

Since:
1.1
Author:
seth proctor

Constructor Summary
SamplePolicyBuilder()
           
 
Method Summary
static com.sun.xacml.Target createPolicyTarget()
          Creates the Target used in the Policy.
static com.sun.xacml.Rule createRule()
          Creates the Rule used in the Policy.
static com.sun.xacml.cond.Apply createRuleCondition()
          Creates the Condition used in the Rule.
static com.sun.xacml.Target createRuleTarget()
          Creates the Target used in the Condition.
static com.sun.xacml.TargetMatch createTargetMatch(int type, java.lang.String functionId, com.sun.xacml.attr.AttributeDesignator designator, com.sun.xacml.attr.AttributeValue value)
          Simple helper routine that creates a TargetMatch instance.
static void main(java.lang.String[] args)
          Command-line routine that bundles together all the information needed to create a Policy and then encodes the Policy, printing to standard out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SamplePolicyBuilder

public SamplePolicyBuilder()
Method Detail

createTargetMatch

public static com.sun.xacml.TargetMatch createTargetMatch(int type,
                                                          java.lang.String functionId,
                                                          com.sun.xacml.attr.AttributeDesignator designator,
                                                          com.sun.xacml.attr.AttributeValue value)
Simple helper routine that creates a TargetMatch instance.

Parameters:
type - the type of match
functionId - the matching function identifier
designator - the AttributeDesignator used in this match
value - the AttributeValue used in this match
Returns:
the matching element

createPolicyTarget

public static com.sun.xacml.Target createPolicyTarget()
                                               throws java.net.URISyntaxException
Creates the Target used in the Policy. This Target specifies that the Policy applies to any example.com users who are requesting some form of access to server.example.com.

Returns:
the target
Throws:
java.net.URISyntaxException - if there is a problem with any of the URIs

createRuleTarget

public static com.sun.xacml.Target createRuleTarget()
                                             throws java.net.URISyntaxException
Creates the Target used in the Condition. This Target specifies that the Condition applies to anyone taking the action commit.

Returns:
the target
Throws:
java.net.URISyntaxException - if there is a problem with any of the URIs

createRuleCondition

public static com.sun.xacml.cond.Apply createRuleCondition()
                                                    throws java.net.URISyntaxException
Creates the Condition used in the Rule. Note that a Condition is just a special kind of Apply.

Returns:
the condition
Throws:
java.net.URISyntaxException - if there is a problem with any of the URIs

createRule

public static com.sun.xacml.Rule createRule()
                                     throws java.net.URISyntaxException
Creates the Rule used in the Policy.

Returns:
the rule
Throws:
java.net.URISyntaxException - if there is a problem with any of the URIs

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Command-line routine that bundles together all the information needed to create a Policy and then encodes the Policy, printing to standard out.

Throws:
java.lang.Exception