Package org.jboss.security.xacml.sunxacml

Examples of org.jboss.security.xacml.sunxacml.ParsingException


           
            return AttributeFactory.getInstance().createValue(child, type);
         }
         catch (UnknownIdentifierException uie)
         {
            throw new ParsingException("Unknown AttributeId", uie);
         }
      }
      return null;
   }
View Full Code Here


                            createAbstractFunction(funcName, root);
                        returnType = function.getReturnType();
                        break;
                    } catch (Exception e) {
                        // any exception here is an error
                        throw new ParsingException("invalid abstract map", e);
                    }
                } catch (Exception e) {
                    // any exception that's not function type is an error
                    throw new ParsingException("couldn't parse map body", e);
                }
            }
        }

        // see if we found the return type
        if (returnType == null)
            throw new ParsingException("couldn't find the return type");

        return new MapFunction(returnType);
    }
View Full Code Here

            if (entry instanceof FunctionProxy) {
                try {
                    return ((FunctionProxy)entry).getInstance(root,
                                                              xpathVersion);
                } catch (Exception e) {
                    throw new ParsingException("couldn't create abstract" +
                                               " function " + identity, e);
                }
            } else {
                // this is actually a concrete function, which means that
                // the other create method should have been called
View Full Code Here

        if (proxy != null) {
            try {
                return proxy.getInstance(root);
            } catch (Exception e) {
                throw new ParsingException("couldn't create " + type +
                                           " attribute based on DOM node");
            }
        } else {
            throw new UnknownIdentifierException("Attributes of type " + type +
                                                 " aren't supported.");
View Full Code Here

       
        if (proxy != null) {
            try {
                return proxy.getInstance(value);
            } catch (Exception e) {
                throw new ParsingException("couldn't create " + type +
                                           " attribute from input: " + value);
            }
        } else {
            throw new UnknownIdentifierException("Attributes of type " + type +
                                                 " aren't supported.");
View Full Code Here

        List newEnvironment = null;

        // First check to be sure the node passed is indeed a Request node.
        String tagName = SunxacmlUtil.getNodeName(root);
        if (! tagName.equals("Request")) {
            throw new ParsingException("Request cannot be constructed using " +
                                       "type: " + SunxacmlUtil.getNodeName(root));
        }
       
        // Now go through its child nodes, finding Subject,
        // Resource, Action, and Environment data
        NodeList children = root.getChildNodes();

        for (int i = 0; i < children.getLength(); i++) {
            Node node = children.item(i);
            String tag = SunxacmlUtil.getNodeName(node);

            if (tag.equals("Subject")) {
                // see if there is a category
                Node catNode =
                    node.getAttributes().getNamedItem("SubjectCategory");
                URI category = null;

                if (catNode != null) {
                    try {
                        category = new URI(catNode.getNodeValue());
                    } catch (Exception e) {
                        throw new ParsingException("Invalid Category URI", e);
                    }
                }
               
                // now we get the attributes
                List attributes = parseAttributes(node);
View Full Code Here

      AttributeFactory attrFactory = AttributeFactory.getInstance();

      // First check that we're really parsing an Attribute
      if (! SunxacmlUtil.getNodeName(root).equals("Attribute")) {
         throw new ParsingException("Attribute object cannot be created " +
               "with root node of type: " +
               SunxacmlUtil.getNodeName(root));
      }

      NamedNodeMap attrs = root.getAttributes();

      try {
         id = new URI(attrs.getNamedItem("AttributeId").getNodeValue());
      } catch (Exception e) {
         throw new ParsingException("Error parsing required attribute " +
               "AttributeId in AttributeType", e);
      }

      try {
         type = new URI(attrs.getNamedItem("DataType").getNodeValue());
      } catch (Exception e) {
         throw new ParsingException("Error parsing required attribute " +
               "DataType in AttributeType", e);
      }           

      try {
         Node issuerNode = attrs.getNamedItem("Issuer");
         if (issuerNode != null)
            issuer = issuerNode.getNodeValue();

         Node instantNode = attrs.getNamedItem("IssueInstant");
         if (instantNode != null)
            issueInstant = DateTimeAttribute.
            getInstance(instantNode.getNodeValue());
      } catch (Exception e) {
         // shouldn't happen, but just in case...
         throw new ParsingException("Error parsing optional AttributeType"
               + " attribute", e);
      }

      // now we get the attribute value
      NodeList nodes = root.getChildNodes();
      for (int i = 0; i < nodes.getLength(); i++) {
         Node node = nodes.item(i);
         if (SunxacmlUtil.getNodeName(node).equals("AttributeValue")) {
            // only one value can be in an Attribute
           
            /*
             * SECURITY-157: multiple values
             *
             * if (value != null)
               throw new ParsingException("Too many values in Attribute");
             */
            // now get the value
            try {
               value = attrFactory.createValue(node, type);
            } catch (UnknownIdentifierException uie) {
               throw new ParsingException("Unknown AttributeId", uie);
            }
            if(valueSet == null)
               valueSet = new HashSet<AttributeValue>();
            valueSet.add(value);
         }
      }

      // make sure we got a value
      if (value == null)
         throw new ParsingException("Attribute must contain a value");

      return new Attribute(id, type, issuer, issueInstant, valueSet);
   }
View Full Code Here

                results.add(Result.getInstance(node));
            }
        }

        if (results.size() == 0)
            throw new ParsingException("must have at least one Result");

        return new ResponseCtx(results);
    }
View Full Code Here

            DocumentBuilder db = factory.newDocumentBuilder();
            Document doc = db.parse(new ByteArrayInputStream(bytes));

            return doc.getDocumentElement();
        } catch (Exception e) {
            throw new ParsingException("invalid XML for status detail");
        }
    }
View Full Code Here

     * @throws ParsingException if the root node is invalid
     */
    public static StatusDetail getInstance(Node root) throws ParsingException {
        // check that it's really a StatusDetailType root
        if (! SunxacmlUtil.getNodeName(root).equals("StatusDetail"))
            throw new ParsingException("not a StatusDetail node");

        return new StatusDetail(root);
    }
View Full Code Here

TOP

Related Classes of org.jboss.security.xacml.sunxacml.ParsingException

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.