eu.xtreemos.xosd.security.vops.xacml.policy
Class PolicyRule

java.lang.Object
  extended by eu.xtreemos.xosd.security.vops.xacml.policy.PolicyRule

public class PolicyRule
extends java.lang.Object

Class for creating policy rules.

Author:
ales.cernivec@xlab.si

Field Summary
private  PolicyRuleCondition condition
           
private  java.lang.String description
           
 int effect
           
(package private) static org.apache.log4j.Logger logger
           
private  java.net.URI ruleId
           
private  PolicyTarget target
           
 
Constructor Summary
PolicyRule()
           
PolicyRule(java.net.URI ruleId, int effect, PolicyTarget pt, java.lang.String description)
           
PolicyRule(java.net.URI ruleId, int effect, java.lang.String description)
           
 
Method Summary
static PolicyRule createPolicyRule(java.util.Hashtable<java.lang.String,java.lang.Object> xmlForm)
          Creates rule based on the xmlForm passed as an argument.
static PolicyRuleCondition getCondition(java.util.Hashtable<java.lang.String,java.lang.Object> jsdlHashTable)
          Extracts from JSDL attributes for request.
 com.sun.xacml.Rule getRule()
          Converts rule to XACML's Rule object.
 java.net.URI getRuleId()
           
 PolicyTarget getTarget()
          Return target used in this Rule
 boolean matchTarget(com.sun.xacml.ctx.RequestCtx req, boolean matchResource)
          This method matches context of the request with the current policy.
 void parse(XMLSearchEngine xse, java.util.Hashtable<java.lang.String,java.lang.Object> inData)
          This method parses policy rule.
 PolicyRuleCondition setCondition(java.util.Hashtable<java.lang.String,java.lang.Object> jsdlHashTable)
          Extracts from JSDL attributes for request.
 void setCondition(PolicyRuleCondition prc)
          Sets rule's target
 void setTarget(PolicyTarget pt)
          Sets rule's target
 
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

ruleId

private java.net.URI ruleId

description

private java.lang.String description

target

private PolicyTarget target

condition

private PolicyRuleCondition condition

effect

public int effect
Constructor Detail

PolicyRule

public PolicyRule()

PolicyRule

public PolicyRule(java.net.URI ruleId,
                  int effect,
                  java.lang.String description)
Parameters:
ruleId -
effect -
description -

PolicyRule

public PolicyRule(java.net.URI ruleId,
                  int effect,
                  PolicyTarget pt,
                  java.lang.String description)
Parameters:
ruleId -
effect -
pt -
description -
Method Detail

getRuleId

public java.net.URI getRuleId()

getTarget

public PolicyTarget getTarget()
Return target used in this Rule

Returns:
PolicyTarget used in this Rule

getRule

public com.sun.xacml.Rule getRule()
                           throws java.lang.Exception
Converts rule to XACML's Rule object.

Returns:
XACML Rule object
Throws:
java.lang.Exception

setTarget

public void setTarget(PolicyTarget pt)
Sets rule's target


setCondition

public void setCondition(PolicyRuleCondition prc)
Sets rule's target


parse

public void parse(XMLSearchEngine xse,
                  java.util.Hashtable<java.lang.String,java.lang.Object> inData)
           throws java.lang.Exception
This method parses policy rule.

Parameters:
xse -
inData -
Throws:
java.lang.Exception

matchTarget

public boolean matchTarget(com.sun.xacml.ctx.RequestCtx req,
                           boolean matchResource)
This method matches context of the request with the current policy. First subject part of the policy is compared against request's subject. If all attributes of the policy's rule apply to request's attributes, bSubjectMatches is set to true. Same as for subject part, resource part of the policy's rule is compared to request's rule part.

Parameters:
context -
matchResource - is set to true if user wants to filter rules by resources
Returns:
boolean True if rule applies to request.

getCondition

public static PolicyRuleCondition getCondition(java.util.Hashtable<java.lang.String,java.lang.Object> jsdlHashTable)
                                        throws java.lang.Exception
Extracts from JSDL attributes for request.

Parameters:
jsdlHashTable - Input from XMLValidatorAndParser class.
Returns:
Throws:
java.lang.Exception

setCondition

public PolicyRuleCondition setCondition(java.util.Hashtable<java.lang.String,java.lang.Object> jsdlHashTable)
                                 throws java.lang.Exception
Extracts from JSDL attributes for request.

Parameters:
jsdlHashTable - Input from XMLValidatorAndParser class.
Returns:
Throws:
java.lang.Exception

createPolicyRule

public static PolicyRule createPolicyRule(java.util.Hashtable<java.lang.String,java.lang.Object> xmlForm)
                                   throws java.lang.Exception
Creates rule based on the xmlForm passed as an argument. Extracts all information from XML form and uses those as attributes of the policy rule. TODO String should not be hardcoded!

Parameters:
xmlForm - Hashtable containing the information of the xmlForm
Returns:
PolicyRule object, which will be part of the Policy object
Throws:
java.lang.Exception