|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.xtreemos.xosd.vops.xacml.utils.PolicyFactory
public class PolicyFactory
Policy factory.
Field Summary | |
---|---|
private static java.lang.Object |
accessMutex
Mutex object |
private static java.lang.Object |
changingStorage
Lock when changing policy storage! |
(package private) static java.lang.String |
delim
System dependent delimiter. |
private static boolean |
isChanged
If policies in policyStorage are changed, this field is set to true; |
(package private) static java.util.ArrayList<IResource> |
listOfResources
Experiamental |
private static java.lang.Object |
lock1
|
(package private) static org.apache.log4j.Logger |
logger
|
private static java.util.ArrayList<Policy> |
policyStorage
This storage holds all policies in memory. |
(package private) static java.io.File |
storeDir
Policy storage |
private static VopsPDP |
vopspdp
This is PDP for policies stored in policy storage. |
Constructor Summary | |
---|---|
PolicyFactory()
|
Method Summary | |
---|---|
private static void |
addRuleForResource(java.util.ArrayList<java.lang.String> policyFileNames,
com.sun.xacml.Rule ruleToAdd,
java.lang.String resource,
java.lang.String groupName)
Deprecated. |
private static void |
addRuleToPolicy(java.util.ArrayList<java.lang.String> policyFileNames,
java.lang.String policyId,
com.sun.xacml.Rule ruleToAdd)
Deprecated. |
static void |
addRuleToPolicy(PolicyRule pr,
java.lang.String policyId)
Adds rule from XML form as XACML rule into policy |
static java.lang.String |
addRuleToPolicy(com.sun.xacml.Rule rule,
java.lang.String policyId)
Deprecated. |
static void |
addRuleToPolicy(java.lang.String pathToForm,
Policy policy)
Deprecated. |
static java.lang.String |
addRuleToPolicy(java.lang.String ruleId,
java.lang.String policyId,
java.lang.String action,
java.lang.String attr,
java.lang.String groupName)
Deprecated. |
static Policy |
createEmptyPolicy(java.net.URI policyId,
java.lang.String policyDescription)
Creates empty policy with policy id and policy description. |
static com.sun.xacml.Policy |
createPermitPolicy(java.lang.String policyID,
java.lang.String description,
java.lang.String targetId,
java.lang.String targetResource)
Deprecated. |
static java.lang.String |
createPolicy(java.lang.String policyID,
java.lang.String description,
java.lang.String targetResource)
Deprecated. |
static com.sun.xacml.Target |
createPolicyTarget(java.lang.String sSubject,
java.lang.String sResource)
Deprecated. |
static com.sun.xacml.Rule |
createRule(java.lang.String ruleId,
java.lang.String targetAction,
java.lang.String conditionAttribute,
java.lang.String conditionAttributesValue)
Deprecated. |
static com.sun.xacml.cond.Apply |
createRuleCondition(java.lang.String attribute,
java.lang.String value)
Deprecated. |
static com.sun.xacml.Target |
createRuleTarget(java.lang.String sAction)
Deprecated. |
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 com.sun.xacml.ctx.ResponseCtx |
evaluateRequest(com.sun.xacml.ctx.RequestCtx request)
Evaluates request. |
static Policy |
getFilteredPolicy(com.sun.xacml.ctx.RequestCtx request,
boolean matchResources)
Filters policies based on the provided request. |
static Policy |
getFilteredPolicy(java.security.cert.X509Certificate cert)
Deprecated. |
static Policy |
getPolicy(java.lang.String policyId)
Returns policy from policy storage with specified policyId. |
private static java.lang.String |
getPolicyFile(java.lang.String policyId,
java.util.ArrayList<java.lang.String> policyFiles)
Deprecated. |
private static java.util.ArrayList<java.lang.String> |
getPolicyFiles(java.io.File policyStorageDirectory)
Returns list of all files (filenames) of XACML policies. |
static void |
initializePDP()
Initializes PDP: parses policies from local storage directory and adds them into arraylist of policies for easier access. |
static java.util.ArrayList<Policy> |
listPolicies()
Lists all policies in policy storage. |
static Policy |
listPolicy(java.lang.String policyId)
Returns policy as String |
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. |
private static org.w3c.dom.Document |
parsePolicy(java.lang.String filename)
Parses file into DOM structure |
private static java.lang.String |
readFileAsString(java.lang.String filePath)
|
private static void |
refreshVopsPDP()
Refreshes VopsPDP |
static void |
registerResource(IResource res)
EXPERIMENTAL! This method registers resource into local PDP. |
static java.lang.Object |
reloadVOPS()
Reloads VOPS policy storage. |
static void |
removePolicy(java.lang.String policyId)
Deletes policy with PolicyId from policy storage (in our case deletes file containing policy with PolicyId from directory with policies stored). |
static void |
removePolicyRule(java.lang.String policyId,
java.lang.String ruleId)
Deprecated. |
static boolean |
removeRuleFromPolicy(java.lang.String ruleId,
java.lang.String policyId)
Removes rule from policy with specified policyId. |
static void |
setPolicyDirStorage(java.lang.String storeDirPath)
Sets storage directory for policy storage. |
static void |
updatePolicyStorage()
Writes back all policies from policyStorage arrayList. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static VopsPDP vopspdp
private static java.lang.Object lock1
private static java.lang.Object changingStorage
static final org.apache.log4j.Logger logger
static java.lang.String delim
static java.util.ArrayList<IResource> listOfResources
private static java.util.ArrayList<Policy> policyStorage
private static boolean isChanged
private static java.lang.Object accessMutex
static java.io.File storeDir
Constructor Detail |
---|
public PolicyFactory()
Method Detail |
---|
public static com.sun.xacml.Policy createPermitPolicy(java.lang.String policyID, java.lang.String description, java.lang.String targetId, java.lang.String targetResource) throws java.lang.Exception
policyID
- Policy IDdescription
- Descrition of policytargetId
- Not used for nowtargetResource
- For which resource this policy accounts to?ruleTargetAction
- *deprecated Which action are we permitting?ruleConditionAttribute
- *deprecated Which attribute must have value of ruleConditionValueOfAttribute to permit requestruleConditionValueOfAttribute
- *deprecated The value of ruleConditionAttribute
java.lang.Exception
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)
type
- the type of matchfunctionId
- the matching function identifierdesignator
- the AttributeDesignator used in this matchvalue
- the AttributeValue used in this match
public static com.sun.xacml.Target createPolicyTarget(java.lang.String sSubject, java.lang.String sResource) throws java.net.URISyntaxException
java.net.URISyntaxException
- if there is a problem with any of the URIspublic static com.sun.xacml.Target createRuleTarget(java.lang.String sAction) throws java.net.URISyntaxException
java.net.URISyntaxException
- if there is a problem with any of the URIspublic static com.sun.xacml.cond.Apply createRuleCondition(java.lang.String attribute, java.lang.String value) throws java.net.URISyntaxException
java.net.URISyntaxException
- if there is a problem with any of the URIspublic static com.sun.xacml.Rule createRule(java.lang.String ruleId, java.lang.String targetAction, java.lang.String conditionAttribute, java.lang.String conditionAttributesValue) throws java.net.URISyntaxException
java.net.URISyntaxException
- if there is a problem with any of the URIsprivate static java.lang.String readFileAsString(java.lang.String filePath) throws java.io.IOException
filePath
- the name of the file to open. Not sure if it can accept URLs or just filenames. Path handling could be better, and buffer sizes are hardcoded
java.io.IOException
private static org.w3c.dom.Document parsePolicy(java.lang.String filename)
filename
-
private static void addRuleForResource(java.util.ArrayList<java.lang.String> policyFileNames, com.sun.xacml.Rule ruleToAdd, java.lang.String resource, java.lang.String groupName) throws java.lang.Exception
policyFileNames
- files where policies are storedruleToAdd
- newly created policyresource
- which resource does this policy account togroupName
- which group name are we permitting usage of this resource
java.lang.Exception
private static java.lang.String getPolicyFile(java.lang.String policyId, java.util.ArrayList<java.lang.String> policyFiles) throws java.lang.Exception
policyId
- policyFiles
-
java.lang.Exception
public static void setPolicyDirStorage(java.lang.String storeDirPath) throws java.lang.Exception
storeDirPath
-
java.lang.Exception
private static java.util.ArrayList<java.lang.String> getPolicyFiles(java.io.File policyStorageDirectory)
policyStorageDirectory
-
private static void addRuleToPolicy(java.util.ArrayList<java.lang.String> policyFileNames, java.lang.String policyId, com.sun.xacml.Rule ruleToAdd) throws java.lang.Exception
files
- list of policy filespolicyId
- id of policyruleId
- action
- of new ruleattr
- of ruleattrVal
- value for provided attribute
java.lang.Exception
public static java.lang.String addRuleToPolicy(java.lang.String ruleId, java.lang.String policyId, java.lang.String action, java.lang.String attr, java.lang.String groupName) throws java.lang.Exception
ruleId
- of new rulepolicyId
- to which new rule will be addedaction
- for which action are we applying this ruleattr
- attribute for this rule (e.g. group, username)groupName
- This is actually attribute value
java.lang.Exception
public static java.lang.String addRuleToPolicy(com.sun.xacml.Rule rule, java.lang.String policyId) throws java.lang.Exception
rule
- newly generated policypolicyId
- Id of destination policy
java.lang.Exception
public static void addRuleToPolicy(java.lang.String pathToForm, Policy policy) throws java.lang.Exception
pathToForm
- - Path to local file where XML of the request resides.policy
- into which rule will be added
java.lang.Exception
public static void addRuleToPolicy(PolicyRule pr, java.lang.String policyId) throws java.lang.Exception
pathToForm
- - Path to local file where XML of the request resides.policy
- into which rule will be added
java.lang.Exception
public static boolean removeRuleFromPolicy(java.lang.String ruleId, java.lang.String policyId) throws java.lang.Exception
ruleId
- Rule which will be removed from policy.policyId
- policy from which this rule is removed.
java.lang.Exception
public static java.lang.Object reloadVOPS() throws java.lang.Exception
java.lang.Exception
public static void removePolicyRule(java.lang.String policyId, java.lang.String ruleId) throws java.lang.Exception
PolicyId
- action
- attrType
- attrVal
-
java.lang.Exception
public static Policy getPolicy(java.lang.String policyId)
policyId
-
public static void removePolicy(java.lang.String policyId) throws java.lang.Exception
policyId
-
java.lang.Exception
public static java.lang.String createPolicy(java.lang.String policyID, java.lang.String description, java.lang.String targetResource) throws java.lang.Exception
policyID
- description
- of policyresource
- The resource to which this policy accounts to
java.lang.Exception
public static java.util.ArrayList<Policy> listPolicies()
public static Policy listPolicy(java.lang.String policyId)
policyId
-
public static void initializePDP() throws java.lang.Exception
java.lang.Exception
private static void refreshVopsPDP() throws java.lang.Exception
java.lang.Exception
public static void updatePolicyStorage() throws java.lang.Exception
java.lang.Exception
public static com.sun.xacml.ctx.ResponseCtx evaluateRequest(com.sun.xacml.ctx.RequestCtx request)
request
-
public static Policy getFilteredPolicy(com.sun.xacml.ctx.RequestCtx request, boolean matchResources) throws java.lang.Exception
request
- XACML request which is tested against rulesmatchRequest
- set to true if we want to match also resource data (besides user data)
java.lang.Exception
public static Policy getFilteredPolicy(java.security.cert.X509Certificate cert)
cert
- Certificate used to construct request.
public static void registerResource(IResource res)
res
- resource to registerpublic static Policy createEmptyPolicy(java.net.URI policyId, java.lang.String policyDescription) throws java.lang.Exception
policyId
- policyDescription
-
java.lang.Exception
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |