Search in sources :

Example 1 with PolicyDecisionPoint

use of org.jboss.security.xacml.interfaces.PolicyDecisionPoint in project wildfly by wildfly.

the class JBossPDPInteroperabilityTestCase method testInteropTestWithXMLRequests.

/**
     * Validates the 7 Oasis XACML Interoperability Use Cases.
     *
     * @throws Exception
     */
@Test
public void testInteropTestWithXMLRequests() throws Exception {
    assertNotNull("PDPServiceBean should be injected.", pdpServiceBean);
    final PolicyDecisionPoint pdp = pdpServiceBean.getJBossPDP();
    assertNotNull("JBossPDP should be not-null", pdp);
    assertEquals("Case 1 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, "scenario2-testcase1-request.xml"));
    assertEquals("Case 2 should be permit", XACMLConstants.DECISION_PERMIT, getDecision(pdp, "scenario2-testcase2-request.xml"));
    assertEquals("Case 3 should be permit", XACMLConstants.DECISION_PERMIT, getDecision(pdp, "scenario2-testcase3-request.xml"));
    assertEquals("Case 4 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, "scenario2-testcase4-request.xml"));
    assertEquals("Case 5 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, "scenario2-testcase5-request.xml"));
    assertEquals("Case 6 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, "scenario2-testcase6-request.xml"));
    assertEquals("Case 7 should be permit", XACMLConstants.DECISION_PERMIT, getDecision(pdp, "scenario2-testcase7-request.xml"));
}
Also used : PolicyDecisionPoint(org.jboss.security.xacml.interfaces.PolicyDecisionPoint) Test(org.junit.Test)

Example 2 with PolicyDecisionPoint

use of org.jboss.security.xacml.interfaces.PolicyDecisionPoint in project wildfly by wildfly.

the class JBossPDPInteroperabilityTestCase method testInteropTestWithObjects.

/**
     * Tests PDP evaluation of XACML requests provided as the objects (Oasis XACML Interoperability Use Cases).
     *
     * @throws Exception
     */
@Test
public void testInteropTestWithObjects() throws Exception {
    assertNotNull("PDPServiceBean should be injected.", pdpServiceBean);
    final PolicyDecisionPoint pdp = pdpServiceBean.getJBossPDP();
    assertNotNull("JBossPDP should be not-null", pdp);
    assertEquals("Case 1 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, getRequestContext("false", "false", 10)));
    assertEquals("Case 2 should be permit", XACMLConstants.DECISION_PERMIT, getDecision(pdp, getRequestContext("false", "false", 1)));
    assertEquals("Case 3 should be permit", XACMLConstants.DECISION_PERMIT, getDecision(pdp, getRequestContext("true", "false", 5)));
    assertEquals("Case 4 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, getRequestContext("false", "false", 9)));
    assertEquals("Case 5 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, getRequestContext("true", "false", 10)));
    assertEquals("Case 6 should be deny", XACMLConstants.DECISION_DENY, getDecision(pdp, getRequestContext("true", "false", 15)));
    assertEquals("Case 7 should be permit", XACMLConstants.DECISION_PERMIT, getDecision(pdp, getRequestContext("true", "true", 10)));
}
Also used : PolicyDecisionPoint(org.jboss.security.xacml.interfaces.PolicyDecisionPoint) Test(org.junit.Test)

Aggregations

PolicyDecisionPoint (org.jboss.security.xacml.interfaces.PolicyDecisionPoint)2 Test (org.junit.Test)2