Package org.jboss.security.xacml.interfaces

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


         if(xacmlRequest == null)
            throw new IOException("XACML Request not parsed");

         RequestType requestType = xacmlRequest.getRequest();
        
         RequestContext requestContext = new JBossRequestContext();
         requestContext.setRequest(requestType);
        
         //pdp evaluation is thread safe
         ResponseContext responseContext = pdp.evaluate(requestContext)
        
         ResponseType responseType = new ResponseType();
View Full Code Here


    */
   public static RequestContext createRequestWithNormalRoles(Principal principal, List<String> roles,
         String resourceId, List<String> confidentialityCodes, List<String> consentedIds, String resourceType,
         List<String> resourcePermissions)
   {
      RequestContext request = RequestResponseContextFactory.createRequestCtx();

      RequestType requestType = createRequestType(principal, resourceId, confidentialityCodes, consentedIds,
            resourceType, resourcePermissions);
      addNormalRoles(roles, requestType);

      try
      {
         request.setRequest(requestType);
         if (debug)
            request.marshall(System.out);
      }
      catch (IOException e)
      {
      }

View Full Code Here

    */
   public static RequestContext createRequestWithHL7Permissions(Principal principal, List<String> permissions,
         String resourceId, List<String> confidentialityCodes, List<String> consentedIds, String resourceType,
         List<String> resourcePermissions)
   {
      RequestContext request = RequestResponseContextFactory.createRequestCtx();

      RequestType requestType = createRequestType(principal, resourceId, confidentialityCodes, consentedIds,
            resourceType, resourcePermissions);
      addHL7Permissions(permissions, requestType);

      try
      {
         request.setRequest(requestType);
         if (debug)
            request.marshall(System.out);
      }
      catch (IOException e)
      {
      }

View Full Code Here

      HttpRequestUtil util = new HttpRequestUtil();
      HttpServletRequest req = util.createRequest(p, requestURI);

      //Check PERMIT condition
      WebPEP pep = new WebPEP();
      RequestContext request = pep.createXACMLRequest(req, p, grp);
      if (debug)
         request.marshall(System.out);

      assertEquals("Access Allowed?", XACMLConstants.DECISION_PERMIT, XACMLTestUtil.getDecision(pdp, request));
   }
View Full Code Here

      HttpRequestUtil util = new HttpRequestUtil();
      HttpServletRequest req = util.createRequest(p, requestURI);

      //Check DENY condition
      WebPEP pep = new WebPEP();
      RequestContext request = pep.createXACMLRequest(req, p, grp);
      if (debug)
         request.marshall(System.out);

      assertEquals("Access Disallowed?", XACMLConstants.DECISION_DENY, XACMLTestUtil.getDecision(pdp, request));
   }
View Full Code Here

      requestType.getSubject().add(createSubject());
      requestType.getResource().add(createResource());
      requestType.setAction(createAction());
      requestType.setEnvironment(new EnvironmentType());

      RequestContext requestCtx = RequestResponseContextFactory.createRequestCtx();
      requestCtx.setRequest(requestType);

      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
      InputStream is = tcl.getResourceAsStream("test/config/interopPolicySetConfig.xml");
      assertNotNull("InputStream != null", is);
      PolicyDecisionPoint pdp = new JBossPDP(is);
View Full Code Here

   @SuppressWarnings("unchecked")
   public RequestContext createXACMLRequest(HttpServletRequest request, Principal principal, Group roleGroup)
         throws Exception
   {
      RequestContext requestCtx = RequestResponseContextFactory.createRequestCtx();

      //Create a subject type
      SubjectType subject = new SubjectType();
      subject.getAttribute().add(
            RequestAttributeFactory.createStringAttributeType(XACMLConstants.ATTRIBUTEID_SUBJECT_ID, "jboss.org",
                  principal.getName()));
      Enumeration<Principal> roles = (Enumeration<Principal>) roleGroup.members();
      while (roles.hasMoreElements())
      {
         Principal rolePrincipal = roles.nextElement();
         AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
               XACMLConstants.ATTRIBUTEID_ROLE, "jboss.org", rolePrincipal.getName());
         subject.getAttribute().add(attSubjectID);
      }

      //Create a resource type
      ResourceType resourceType = new ResourceType();
      resourceType.getAttribute().add(
            RequestAttributeFactory.createAnyURIAttributeType(XACMLConstants.ATTRIBUTEID_RESOURCE_ID, null, new URI(
                  request.getRequestURI())));

      //Create an action type
      ActionType actionType = new ActionType();
      actionType.getAttribute().add(
            RequestAttributeFactory
                  .createStringAttributeType(XACMLConstants.ATTRIBUTEID_ACTION_ID, "jboss.org", "read"));

      //Create an Environment Type (Optional)
      EnvironmentType environmentType = new EnvironmentType();
      environmentType.getAttribute().add(
            RequestAttributeFactory.createDateTimeAttributeType(XACMLConstants.ATTRIBUTEID_CURRENT_TIME, null));

      //Create a Request Type
      RequestType requestType = new RequestType();
      requestType.getSubject().add(subject);
      requestType.getResource().add(resourceType);
      requestType.setAction(actionType);
      requestType.setEnvironment(environmentType);

      requestCtx.setRequest(requestType);

      return requestCtx;
   }
View Full Code Here

   public static ResponseContext getResponse(PolicyDecisionPoint pdp,
         String requestFileLoc) throws Exception
   {
      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
      InputStream is = tcl.getResourceAsStream(requestFileLoc);
      RequestContext request = RequestResponseContextFactory.createRequestCtx();
      request.readRequest(is);
      if (debug)
         request.marshall(System.out);
      return getResponse(pdp,request);
   }
View Full Code Here

      HttpRequestUtil util = new HttpRequestUtil();
      HttpServletRequest req = util.createRequest(p, requestURI);

      //Check PERMIT condition
      WebPEP pep = new WebPEP();
      RequestContext request = pep.createXACMLRequest(req, p, grp);
      if (debug)
         request.marshall(System.out);

      assertEquals("Access Allowed?", XACMLConstants.DECISION_PERMIT, XACMLTestUtil.getDecision(pdp, request));
   }
View Full Code Here

      HttpRequestUtil util = new HttpRequestUtil();
      HttpServletRequest req = util.createRequest(p, requestURI);

      //Check DENY condition
      WebPEP pep = new WebPEP();
      RequestContext request = pep.createXACMLRequest(req, p, grp);
      if (debug)
         request.marshall(System.out);

      assertEquals("Access Disallowed?", XACMLConstants.DECISION_DENY, XACMLTestUtil.getDecision(pdp, request));
   }
View Full Code Here

TOP

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

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.