Package org.jboss.security.xacml.interfaces

Examples of org.jboss.security.xacml.interfaces.PolicyDecisionPoint


     * @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,
View Full Code Here


     * @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)));
View Full Code Here

      try
      {
         RequestContext requestCtx = util.createXACMLRequest(this.ejbName,
               this.ejbMethod.getName(),this.ejbPrincipal, callerRoles);
        
         PolicyDecisionPoint pdp = util.getPDP(policyRegistration, this.policyContextID);
         if(pdp == null)
            throw new IllegalStateException("PDP is null");
        
         ResponseContext response = pdp.evaluate(requestCtx);
         result = response.getDecision() == XACMLConstants.DECISION_PERMIT ?
               AuthorizationContext.PERMIT : AuthorizationContext.DENY;
      }
      catch(Exception e)
      {
View Full Code Here

   {
      //See if a PDP exists already
      Map<String,Object> contextMap = new HashMap<String,Object>();
      contextMap.put("PDP", "PDP");
     
      PolicyDecisionPoint pdp = null;
      try
      {
         pdp = policyRegistration.getPolicy(contextID,
               PolicyRegistration.XACML, contextMap);
      }
      catch(Exception ignore)
      {  
      }
      if(pdp == null)
      {
         Set<XACMLPolicy> policies = (Set<XACMLPolicy>)policyRegistration.getPolicy(contextID,
               PolicyRegistration.XACML, null);
         if(policies == null)
            throw new IllegalStateException("Missing xacml policy for contextid:" + contextID);
         JBossPolicyLocator jpl = new JBossPolicyLocator(policies);
         JBossPolicySetLocator jpsl = new JBossPolicySetLocator(policies);
         HashSet<PolicyLocator> plset = new HashSet<PolicyLocator>();
         plset.add(jpl);
         plset.add(jpsl);
        
         pdp = new JBossPDP();
         pdp.setPolicies(policies);
         pdp.setLocators(plset);
      }
      return pdp;
   }
View Full Code Here

      {
         RequestContext requestCtx = util.createXACMLRequest(request,callerRoles);
         if(this.policyContextID == null)
           this.policyContextID = PolicyContext.getContextID();
         
         PolicyDecisionPoint pdp = util.getPDP(this.policyRegistration, this.policyContextID);
         ResponseContext response = pdp.evaluate(requestCtx);
         result = response.getDecision() == XACMLConstants.DECISION_PERMIT ?
               AuthorizationContext.PERMIT : AuthorizationContext.DENY;
      }
      catch(Exception e)
      {
View Full Code Here

   private boolean debug = "true".equals(System.getProperty("debug", "false"));

   public void testWebBinding() throws Exception
   {
      PolicyType policyType = constructPolicy();
      PolicyDecisionPoint pdp = new JBossPDP();

      XACMLPolicy policy = PolicyFactory.createPolicy(policyType);
      Set<XACMLPolicy> policies = new HashSet<XACMLPolicy>();
      policies.add(policy);

      pdp.setPolicies(policies);

      //Add the basic locators also
      PolicyLocator policyLocator = new JBossPolicyLocator();
      policyLocator.setPolicies(policies); //Locators need to be given the policies

      Set<PolicyLocator> locators = new HashSet<PolicyLocator>();
      locators.add(policyLocator);
      pdp.setLocators(locators);
      assertNotNull("JBossPDP is != null", pdp);

      Principal p = new Principal()
      {
         public String getName()
View Full Code Here

   public void testPDPForHimss09()
   {
      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
      URL configFile = tcl.getResource("test/config/himss09-interop-config.xml");
      assertNotNull("configFile != null", configFile);
      PolicyDecisionPoint pdp = new JBossPDP(configFile);
      assertNotNull(pdp);
   }
View Full Code Here

   public void testPDPConfig() throws Exception
   {
      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
      URL configFile = tcl.getResource("test/config/interopPolicySetConfig.xml");
      assertNotNull("configFile != null", configFile);
      PolicyDecisionPoint pdp = new JBossPDP(configFile);
      XACMLTestUtil.validateInteropCases(pdp);
   }
View Full Code Here

   }

   public void testNegativeAccessWebBinding() throws Exception
   {
      PolicyType policyType = constructPolicy();
      PolicyDecisionPoint pdp = new JBossPDP();

      XACMLPolicy policy = PolicyFactory.createPolicy(policyType);
      Set<XACMLPolicy> policies = new HashSet<XACMLPolicy>();
      policies.add(policy);

      pdp.setPolicies(policies);

      //Add the basic locators also
      PolicyLocator policyLocator = new JBossPolicyLocator();
      policyLocator.setPolicies(policies); //Locators need to be given the policies

      Set<PolicyLocator> locators = new HashSet<PolicyLocator>();
      locators.add(policyLocator);
      pdp.setLocators(locators);
      assertNotNull("JBossPDP is != null", pdp);

      Principal p = new Principal()
      {
         public String getName()
View Full Code Here

      Unmarshaller u = jc.createUnmarshaller();
      JAXBElement<?> j = (JAXBElement<?>) u.unmarshal(configFile);
      assertNotNull("JAXBElement is !null", j);
     
      assertNotNull("configFile != null", configFile);
      PolicyDecisionPoint pdp = new JBossPDP(j);
      XACMLTestUtil.validateInteropCases(pdp);
   }
View Full Code Here

TOP

Related Classes of org.jboss.security.xacml.interfaces.PolicyDecisionPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.