Commit 9e157580 authored by cdanger's avatar cdanger

Added non-regression test for issue 25 on OW2 JIRA

parent 10ebbac4
/**
* Copyright (C) 2012-2016 Thales Services SAS.
* Copyright (C) 2012-2017 Thales Services SAS.
*
* This file is part of AuthZForce CE.
*
......@@ -169,7 +169,7 @@ public final class IndividualDecisionRequestContext implements EvaluationContext
* putAttributeDesignatorResultIfAbsent() in this case. In any case, we do not support setting a different result for same id (but different datatype URI/datatype class) in the same
* context
*/
LOGGER.error("Attempt to override value of AttributeDesignator {} already set in evaluation context. Overriding value: {}", id, result);
LOGGER.warn("Attempt to override value of AttributeDesignator {} already set in evaluation context. Overriding value: {}", id, result);
return false;
}
......
/**
* Copyright (C) 2012-2016 Thales Services SAS.
* Copyright (C) 2012-2017 Thales Services SAS.
*
* This file is part of AuthZForce CE.
*
......@@ -86,7 +86,7 @@ public final class MatchEvaluator
final FunctionExpression matchFunction = expFactory.getFunction(matchId);
if (matchFunction == null)
{
throw new IllegalArgumentException("Unsupported function for MatchId: " + matchId);
throw new IllegalArgumentException("Unsupported function for MatchId: '" + matchId + "'");
}
// next, get the designator or selector being used, and the attribute
......
PDP initialization must fail with IllegalArgumentException when using unknown/unsupported Function as Match function
<?xml version="1.0" encoding="UTF-8"?>
<!-- Testing parameter 'maxPolicySetRefDepth' -->
<pdp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://authzforce.github.io/core/xmlns/pdp/5.0" version="5.0.0">
<rootPolicyProvider id="rootPolicyProvider" xsi:type="StaticRootPolicyProvider" policyLocation="${PARENT_DIR}/policy.xml" />
</pdp>
<?xml version="1.0" encoding="UTF-8"?>
<PolicySet xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
PolicySetId="root" Version="1.0"
PolicyCombiningAlgId="urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:ordered-permit-overrides">
<Target />
<Policy PolicyId="P1" Version="1.0"
RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:ordered-permit-overrides">
<Target />
<Rule RuleId="R1" Effect="Permit">
<Description>Rule using unknown Function as Match function: urn:oasis:names:tc:xacml:2.0:function:string-equal instead of urn:oasis:names:tc:xacml:1.0:function:string-equal</Description>
<Target>
<AnyOf>
<AllOf>
<Match MatchId="urn:oasis:names:tc:xacml:2.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">a</AttributeValue>
<AttributeDesignator
Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment"
AttributeId="arg1" DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="true" />
</Match>
</AllOf>
</AnyOf>
</Target>
</Rule>
</Policy>
</PolicySet>
\ No newline at end of file
PDP initialization must fail with IllegalArgumentException when using unknown/unsupported Function as Apply function
<?xml version="1.0" encoding="UTF-8"?>
<!-- Testing parameter 'maxPolicySetRefDepth' -->
<pdp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://authzforce.github.io/core/xmlns/pdp/5.0" version="5.0.0">
<rootPolicyProvider id="rootPolicyProvider" xsi:type="StaticRootPolicyProvider" policyLocation="${PARENT_DIR}/policy.xml" />
</pdp>
<?xml version="1.0" encoding="UTF-8"?>
<PolicySet xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicySetId="root" Version="1.0" PolicyCombiningAlgId="urn:oasis:names:tc:xacml:3.0:policy-combining-algorithm:ordered-permit-overrides">
<Target />
<Policy PolicyId="P1" Version="1.0" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:ordered-permit-overrides">
<Target />
<Rule RuleId="R1" Effect="Permit">
<Description>ule using unknown Function as Match function: urn:oasis:names:tc:xacml:2.0:function:string-equal instead of urn:oasis:names:tc:xacml:1.0:function:string-equal</Description>
<Target />
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:2.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">a</AttributeValue>
<AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" AttributeId="arg1" DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="true" />
</Apply>
</Condition>
</Rule>
</Policy>
</PolicySet>
\ No newline at end of file
......@@ -3,8 +3,10 @@ This is the directory for all non-regression tests, where each subdirectory corr
- `pdp.xml` (required) : PDP configuration file
- `pdp-ext.xsd` (optional): XSD for loading PDP extensions such as the TestAttributeFinder, required only if such extensions are used in the PDP configuration file
- `policy.xml` (required): XACML Policy(Set) file
- `request.xml` (required): XACML Request
- `response.xml` (required): expected response for the test to succeed
- `request.xml` (optional): XACML Request, absent if the test is only a PDP initialization test (e.g. policy validation)
- `response.xml` (optional): expected XACML Response for the above Request, absent if the test is only PDP initialization test (e.g. policy validation)
- `README.md` (required): title and description of the test, mostly taken from the issue description and comments in the issue management system where the bug was reported.
If the test is a PDP intialization test only, typically a policy syntax validation, we expected an IllegalArgumentException as a result of the test.
If you implement or use a new PDP extension for testing, make sure there have a matching 'system' entry for the resolving the extension XSD location in the XML catalog file `src/test/resources/catalog.xml`, like the one for the TestAttributeFinder XSD.
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment