Package org.jboss.security.xacml.core.model.context

Examples of org.jboss.security.xacml.core.model.context.SubjectType


     * @param buyPrice
     * @return
     */
    private SubjectType createSubject(String reqTradeAppr, String reqCreditAppr, int buyPrice) {
        // Create a subject type
        SubjectType subject = new SubjectType();
        subject.setSubjectCategory("urn:oasis:names:tc:xacml:1.0:subject-category:access-subject");
        // create the subject attributes
        AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
                "urn:oasis:names:tc:xacml:1.0:subject:subject-id", "xacml20.interop.com", "123456");
        subject.getAttribute().add(attSubjectID);

        AttributeType attUserName = RequestAttributeFactory.createStringAttributeType(
                "urn:xacml:2.0:interop:example:subject:user-name", "xacml20.interop.com", "John Smith");
        subject.getAttribute().add(attUserName);

        AttributeType attBuyNumShares = RequestAttributeFactory.createIntegerAttributeType(
                "urn:xacml:2.0:interop:example:subject:buy-num-shares", "xacml20.interop.com", 1000);
        subject.getAttribute().add(attBuyNumShares);

        AttributeType attBuyOfferShare = RequestAttributeFactory.createIntegerAttributeType(
                "urn:xacml:2.0:interop:example:subject:buy-offer-price", "xacml20.interop.com", buyPrice);
        subject.getAttribute().add(attBuyOfferShare);

        AttributeType attRequestExtCred = RequestAttributeFactory.createStringAttributeType(
                "urn:xacml:2.0:interop:example:subject:req-credit-ext-approval", "xacml20.interop.com", reqCreditAppr);
        subject.getAttribute().add(attRequestExtCred);

        AttributeType attRequestTradeApproval = RequestAttributeFactory.createStringAttributeType(
                "urn:xacml:2.0:interop:example:subject:req-trade-approval", "xacml20.interop.com", reqTradeAppr);
        subject.getAttribute().add(attRequestTradeApproval);

        return subject;
    }
View Full Code Here


      String action = methodName;

      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()));

      List<Role> rolesList = callerRoles.getRoles();
      if(rolesList != null)
      {
         for(Role role:rolesList)
         {
            String roleName = role.getRoleName();
            AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
                  XACMLConstants.ATTRIBUTEID_ROLE, "jboss.org", roleName);
            subject.getAttribute().add(attSubjectID);
         }
      }

      //Create a resource type
      ResourceType resourceType = new ResourceType();
View Full Code Here

     
     
      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()));
     
      List<Role> rolesList = callerRoles.getRoles();
      if(rolesList != null)
      {
         for(Role role:rolesList)
         {
            String roleName = role.getRoleName();
            AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
                  XACMLConstants.ATTRIBUTEID_ROLE, "jboss.org", roleName);
            subject.getAttribute().add(attSubjectID);
         }
      }

      //Create a resource type
      ResourceType resourceType = new ResourceType();
View Full Code Here

         List<String> resourcePermissions)
   {
      RequestType requestType = new RequestType();

      //create the Subject of the request
      SubjectType subject = new SubjectType();
      subject.getAttribute().add(
            RequestAttributeFactory.createStringAttributeType(XACMLConstants.ATTRIBUTEID_SUBJECT_ID, null, principal
                  .getName()));
      requestType.getSubject().add(subject);

      //create the Resource of the request
View Full Code Here

    * @param roles <code>List</code> of roles the subject has.
    * @param request a XACML request.
    */
   public static void addNormalRoles(List<String> roles, RequestType request)
   {
      SubjectType subject = request.getSubject().iterator().next();
      if (subject != null)
      {
         for (String role : roles)
         {
            subject.getAttribute().add(
                  RequestAttributeFactory.createStringAttributeType(XACMLConstants.ATTRIBUTEID_ROLE, null, role));
         }
      }
   }
View Full Code Here

    * @param permissions <code>List</code> of permissions the subject has.
    * @param request a XACML request.
    */
   public static void addHL7Permissions(List<String> permissions, RequestType request)
   {
      SubjectType subject = request.getSubject().iterator().next();
      if (subject != null)
      {
         for (String permission : permissions)
         {
            subject.getAttribute().add(
                  RequestAttributeFactory.createStringAttributeType(HL7_SUBJECT_PERMISSION, null, permission));
         }
      }
   }
View Full Code Here

   }

   private SubjectType createSubject()
   {
      //Create a subject type
      SubjectType subject = new SubjectType();
      subject.setSubjectCategory("urn:oasis:names:tc:xacml:1.0:subject-category:access-subject");
      //create the subject attributes
      AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
            "urn:oasis:names:tc:xacml:1.0:subject:subject-id", "xacml20.interop.com", "123456");
      subject.getAttribute().add(attSubjectID);

      AttributeType attUserName = RequestAttributeFactory.createStringAttributeType(
            "urn:xacml:2.0:interop:example:subject:user-name", "xacml20.interop.com", "John Smith");
      subject.getAttribute().add(attUserName);

      AttributeType attBuyNumShares = RequestAttributeFactory.createIntegerAttributeType(
            "urn:xacml:2.0:interop:example:subject:buy-num-shares", "xacml20.interop.com", 1000);
      subject.getAttribute().add(attBuyNumShares);

      AttributeType attBuyOfferShare = RequestAttributeFactory.createIntegerAttributeType(
            "urn:xacml:2.0:interop:example:subject:buy-offer-price", "xacml20.interop.com", 100);
      subject.getAttribute().add(attBuyOfferShare);

      AttributeType attRequestExtCred = RequestAttributeFactory.createStringAttributeType(
            "urn:xacml:2.0:interop:example:subject:req-credit-ext-approval", "xacml20.interop.com", "false");
      subject.getAttribute().add(attRequestExtCred);

      AttributeType attRequestTradeApproval = RequestAttributeFactory.createStringAttributeType(
            "urn:xacml:2.0:interop:example:subject:req-trade-approval", "xacml20.interop.com", "false");
      subject.getAttribute().add(attRequestTradeApproval);

      return subject;
   }
View Full Code Here

         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(
View Full Code Here

   }

   private SubjectType createSubject(String reqTradeAppr, String reqCreditAppr, int buyPrice)
   {
      //Create a subject type
      SubjectType subject = new SubjectType();
      subject.setSubjectCategory("urn:oasis:names:tc:xacml:1.0:subject-category:access-subject");
      //create the subject attributes
      AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
            "urn:oasis:names:tc:xacml:1.0:subject:subject-id", "xacml20.interop.com", "123456");
      subject.getAttribute().add(attSubjectID);

      AttributeType attUserName = RequestAttributeFactory.createStringAttributeType(
            "urn:xacml:2.0:interop:example:subject:user-name", "xacml20.interop.com", "John Smith");
      subject.getAttribute().add(attUserName);

      AttributeType attBuyNumShares = RequestAttributeFactory.createIntegerAttributeType(
            "urn:xacml:2.0:interop:example:subject:buy-num-shares", "xacml20.interop.com", 1000);
      subject.getAttribute().add(attBuyNumShares);

      AttributeType attBuyOfferShare = RequestAttributeFactory.createIntegerAttributeType(
            "urn:xacml:2.0:interop:example:subject:buy-offer-price", "xacml20.interop.com", buyPrice);
      subject.getAttribute().add(attBuyOfferShare);

      AttributeType attRequestExtCred = RequestAttributeFactory.createStringAttributeType(
            "urn:xacml:2.0:interop:example:subject:req-credit-ext-approval", "xacml20.interop.com", reqCreditAppr);
      subject.getAttribute().add(attRequestExtCred);

      AttributeType attRequestTradeApproval = RequestAttributeFactory.createStringAttributeType(
            "urn:xacml:2.0:interop:example:subject:req-trade-approval", "xacml20.interop.com", reqTradeAppr);
      subject.getAttribute().add(attRequestTradeApproval);

      return subject;
   }
View Full Code Here

  public static String createXACMLRequest(String fodselsNr, String orgNr, String serviceCode, String serviceEditionCode, String environment) {
    String xacmlString = null;
    RequestContext requestContext = RequestResponseContextFactory.createRequestCtx();

    // Subject
    SubjectType subject = new SubjectType();
    subject.getAttribute().add(RequestAttributeFactory.createStringAttributeType(SUBJECT_IDENTIFIER_SSN, "jboss_org", fodselsNr));

    // Resources
    ResourceType resourceType = new ResourceType();
    resourceType.getAttribute().add(RequestAttributeFactory.createStringAttributeType(RESOURCE_IDENTIFIER_ORGNR, "jboss_org", orgNr));
    resourceType.getAttribute().add(RequestAttributeFactory.createStringAttributeType(RESOURCE_IDENTIFIER_SERVICECODE, "jboss_org", serviceCode));
View Full Code Here

TOP

Related Classes of org.jboss.security.xacml.core.model.context.SubjectType

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.