Uploaded image for project: 'PicketBox '
  1. PicketBox
  2. SECURITY-206

Attribute type not set in constructor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • JBossXACML_2.0.3.alpha
    • JBossSecurity_2.0.2.GA
    • JBossXACML
    • None
    • Hide

      Use a different constructor

      Show
      Use a different constructor

      The constructor public Attribute(URI id, String issuer, DateTimeAttribute issueInstant, AttributeValue value) fails to set the attribute's type. Test case and patch below:

      JUnit test case.
      /**

      • */
        package test.attributefinder;

      import static org.junit.Assert.*;

      import java.net.URI;
      import java.net.URISyntaxException;

      import org.jboss.security.xacml.sunxacml.attr.DateTimeAttribute;
      import org.jboss.security.xacml.sunxacml.attr.StringAttribute;
      import org.jboss.security.xacml.sunxacml.ctx.Attribute;
      import org.junit.Test;

      /**

      • @author kevincarlin
        *
        */
        public class AttributeTest {

      /**

      • Test method for {@link org.jboss.security.xacml.sunxacml.ctx.Attribute#Attribute(java.net.URI, java.lang.String, org.jboss.security.xacml.sunxacml.attr.DateTimeAttribute, org.jboss.security.xacml.sunxacml.attr.AttributeValue)}

        .

      • @throws Throwable
        */
        @Test
        public void testAttributeURIStringDateTimeAttributeAttributeValue() throws Throwable { Attribute attribute = new Attribute(new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id"), "com.bifrost.dnipilot", new DateTimeAttribute(), new StringAttribute("Test")); assertNotNull("Attribute type must be set in the constructor", attribute.getType()); }

      }

      Patch:

      Index: security-xacml/trunk/jboss-sunxacml/src/main/java/org/jboss/security/xacml/sunxacml/ctx/Attribute.java
      ===================================================================
      — . (revision 72241)
      +++ . (working copy)
      @@ -99,6 +99,7 @@
      if(this.attributeValues == null)
      this.attributeValues = new HashSet<AttributeValue>();
      this.attributeValues.add(value);
      + this.type = value.getType();
      }

      public Attribute(URI id, URI type, String issuer, DateTimeAttribute issueInstant,

              anil.saldhana Anil Saldanha (Inactive)
              kcarlin_jira Kevin Carlin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: