Package org.apache.xml.security.transforms.params

Examples of org.apache.xml.security.transforms.params.InclusiveNamespaces


                xc.setXPath(
                "self::Parent or (parent::Parent and not(self::Child)) or self::ns1:GrandChild or parent::ns1:GrandChild");
                tf.addTransform(Transforms.TRANSFORM_XPATH, xc.getElement());
            }
            {
                InclusiveNamespaces incNS = new InclusiveNamespaces(doc, "ns2");

                tf.addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS,
                                incNS.getElement());
            }
            xmlSignature.addDocument("iaikTests.example4.xml", tf);
        }

        {
View Full Code Here


                && c14nTransform.length(
                    InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                    InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES) == 1) {

                // there is one InclusiveNamespaces element
                InclusiveNamespaces in =
                    new InclusiveNamespaces(
                        XMLUtils.selectNode(
                            c14nTransform.getElement().getFirstChild(),
                            InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                            InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,
                            0
                        ), this.getBaseURI());

                inclusiveNamespaces =
                    InclusiveNamespaces.prefixStr2Set(in.getInclusiveNamespaces());
            }

            return nodes.getHTMLRepresentation(inclusiveNamespaces);
        } catch (TransformationException ex) {
            throw new XMLSignatureException("empty", ex);
View Full Code Here

                       .length(InclusiveNamespaces
                          .ExclusiveCanonicalizationNamespace, InclusiveNamespaces
                          ._TAG_EC_INCLUSIVENAMESPACES) == 1) {

                  // there is one InclusiveNamespaces element
                  InclusiveNamespaces in = new InclusiveNamespaces(
                        XMLUtils.selectNode(
                        c14nTransform.getElement().getFirstChild(),
            InclusiveNamespaces.ExclusiveCanonicalizationNamespace,
                        InclusiveNamespaces._TAG_EC_INCLUSIVENAMESPACES,0), this.getBaseURI());

                  inclusiveNamespaces = InclusiveNamespaces.prefixStr2Set(
                     in.getInclusiveNamespaces());
               }
            }
         }

         return nodes.getHTMLRepresentation(inclusiveNamespaces);
View Full Code Here

      canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM, canonAlgo);

      if (wssConfig.isWsiBSPCompliant()) {
        Set prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false);

        InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces(
            doc, prefixes);

        canonElem.appendChild(inclusiveNamespaces.getElement());
      }

      try {
        SignatureAlgorithm signatureAlgorithm = new SignatureAlgorithm(
            doc, sigAlgo);
View Full Code Here

          }
          transforms
              .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
          if (wssConfig.isWsiBSPCompliant()) {
            transforms.item(0).getElement().appendChild(
                new InclusiveNamespaces(document,
                    getInclusivePrefixes(toSignById))
                    .getElement());
          }
          sig.addDocument("#" + idToSign, transforms);
        } else if (elemName.equals("Token")) {
          transforms
              .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
          if (keyIdentifierType == WSConstants.BST_DIRECT_REFERENCE) {
            if (wssConfig.isWsiBSPCompliant()) {
              transforms
                  .item(0)
                  .getElement()
                  .appendChild(
                      new InclusiveNamespaces(
                          document,
                          getInclusivePrefixes(secHeader.getSecurityHeader()))
                          .getElement());
            }
            sig.addDocument("#" + certUri, transforms);
          } else {
            if (wssConfig.isWsiBSPCompliant()) {
              transforms.item(0).getElement().appendChild(
                  new InclusiveNamespaces(document,
                      getInclusivePrefixes(keyInfo
                          .getElement()))
                      .getElement());
            }
            sig.addDocument("#" + keyInfoUri, transforms);
          }
        } else if (elemName.equals("STRTransform")) { // STRTransform
          Element ctx = createSTRParameter(document);
          transforms.addTransform(
              STRTransform.implementedTransformURI, ctx);
          sig.addDocument("#" + strUri, transforms);
        } else if (elemName.equals("Assertion")) { // Assertion

          String id = null;
          id = SAMLUtil.getAssertionId(envelope, elemName, nmSpace);

          Element body = (Element) WSSecurityUtil.findElement(
              envelope, elemName, nmSpace);
          if (body == null) {
            throw new WSSecurityException(
                WSSecurityException.FAILURE, "noEncElement",
                new Object[] { nmSpace + ", " + elemName });
          }
          transforms
              .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
          if (wssConfig.isWsiBSPCompliant()) {
            transforms.item(0).getElement().appendChild(
                new InclusiveNamespaces(document,
                    getInclusivePrefixes(body))
                    .getElement());
          }
          String prefix = WSSecurityUtil.setNamespace(body,
              WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
          body.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id);
          sig.addDocument("#" + id, transforms);

        } else {
          Element body = (Element) WSSecurityUtil.findElement(
              envelope, elemName, nmSpace);
          if (body == null) {
            throw new WSSecurityException(
                WSSecurityException.FAILURE, "noEncElement",
                new Object[] { nmSpace + ", " + elemName });
          }
          transforms
              .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
          if (wssConfig.isWsiBSPCompliant()) {
            transforms.item(0).getElement().appendChild(
                new InclusiveNamespaces(document,
                    getInclusivePrefixes(body))
                    .getElement());
          }
          sig.addDocument("#" + setWsuId(body), transforms);
        }
View Full Code Here

            if (wssConfig.isWsiBSPCompliant()) {
                Set prefixes = getInclusivePrefixes(secHeader
                        .getSecurityHeader(), false);

                InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces(
                        doc, prefixes);

                canonElem.appendChild(inclusiveNamespaces.getElement());
            }
            try {
                SignatureAlgorithm signatureAlgorithm = new SignatureAlgorithm(
                        doc, sigAlgo);
                sig = new XMLSignature(doc, null, signatureAlgorithm
View Full Code Here

                    }
                    transforms
                            .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
                    if (wssConfig.isWsiBSPCompliant()) {
                        transforms.item(0).getElement().appendChild(
                                new InclusiveNamespaces(document,
                                        getInclusivePrefixes(toSignById))
                                        .getElement());
                    }
                    sig.addDocument("#" + idToSign, transforms);
                } else if (elemName.equals("Token")) {
                    transforms
                            .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
                    if (keyIdentifierType == WSConstants.BST_DIRECT_REFERENCE) {
                        if (wssConfig.isWsiBSPCompliant()) {
                            transforms.item(0).getElement().appendChild(
                                    new InclusiveNamespaces(document,
                                            getInclusivePrefixes(secHeader
                                                    .getSecurityHeader()))
                                            .getElement());
                        }
                        sig.addDocument("#" + certUri, transforms);
                    } else {
                        if (wssConfig.isWsiBSPCompliant()) {
                            transforms.item(0).getElement().appendChild(
                                    new InclusiveNamespaces(document,
                                            getInclusivePrefixes(keyInfo
                                                    .getElement()))
                                            .getElement());
                        }
                        sig.addDocument("#" + keyInfoUri, transforms);
                    }
                } else if (elemName.equals("STRTransform")) { // STRTransform
                    Element ctx = createSTRParameter(document);
                    transforms.addTransform(
                            STRTransform.implementedTransformURI, ctx);
                    sig.addDocument("#" + strUri, transforms);
                } else {
                    Element body = (Element) WSSecurityUtil.findElement(
                            envelope, elemName, nmSpace);
                    if (body == null) {
                        throw new WSSecurityException(
                                WSSecurityException.FAILURE, "noEncElement",
                                new Object[] { nmSpace + ", " + elemName });
                    }
                    transforms
                            .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
                    if (wssConfig.isWsiBSPCompliant()) {
                        transforms.item(0).getElement().appendChild(
                                new InclusiveNamespaces(document,
                                        getInclusivePrefixes(body))
                                        .getElement());
                    }
                    sig.addDocument("#" + setWsuId(body), transforms);
                }
View Full Code Here

            if (wssConfig.isWsiBSPCompliant()) {
                Set prefixes = getInclusivePrefixes(secHeader
                        .getSecurityHeader(), false);

                InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces(
                        doc, prefixes);

                canonElem.appendChild(inclusiveNamespaces.getElement());
            }

            try {
                SignatureAlgorithm signatureAlgorithm = new SignatureAlgorithm(
                        doc, sigAlgo);
View Full Code Here

                    }
                    transforms
                            .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
                    if (wssConfig.isWsiBSPCompliant()) {
                        transforms.item(0).getElement().appendChild(
                                new InclusiveNamespaces(document,
                                        getInclusivePrefixes(toSignById))
                                        .getElement());
                    }
                    sig.addDocument("#" + idToSign, transforms);
                } else if (elemName.equals("Token")) {
                    transforms
                            .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
                    if (wssConfig.isWsiBSPCompliant()) {
                        transforms.item(0).getElement().appendChild(
                                new InclusiveNamespaces(document,
                                        getInclusivePrefixes(keyInfo
                                                .getElement()))
                                        .getElement());
                    }
                    sig.addDocument("#" + keyInfoUri, transforms);
                } else if (elemName.equals("STRTransform")) { // STRTransform
                    Element ctx = createSTRParameter(document);
                    transforms.addTransform(
                            STRTransform.implementedTransformURI, ctx);
                    sig.addDocument("#" + strUri, transforms);
                } else if (elemName.equals("Assertion")) { // Assertion

                    String id = null;
                    id = SAMLUtil.getAssertionId(envel, elemName, nmSpace);

                    Element body = (Element) WSSecurityUtil.findElement(
                            envel, elemName, nmSpace);
                    if (body == null) {
                        throw new WSSecurityException(
                                WSSecurityException.FAILURE, "noEncElement",
                                new Object[] { nmSpace + ", " + elemName });
                    }
                    transforms
                            .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
                    if (wssConfig.isWsiBSPCompliant()) {
                        transforms.item(0).getElement().appendChild(
                                new InclusiveNamespaces(document,
                                        getInclusivePrefixes(body))
                                        .getElement());
                    }
                    String prefix = WSSecurityUtil.setNamespace(body,
                            WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
                    body.setAttributeNS(WSConstants.WSU_NS, prefix + ":Id", id);
                    sig.addDocument("#" + id, transforms);

                } else {
                    Element body = (Element) WSSecurityUtil.findElement(
                            envel, elemName, nmSpace);
                    if (body == null) {
                        throw new WSSecurityException(
                                WSSecurityException.FAILURE, "noEncElement",
                                new Object[] { nmSpace + ", " + elemName });
                    }
                    transforms
                            .addTransform(Transforms.TRANSFORM_C14N_EXCL_OMIT_COMMENTS);
                    if (wssConfig.isWsiBSPCompliant()) {
                        transforms.item(0).getElement().appendChild(
                                new InclusiveNamespaces(document,
                                        getInclusivePrefixes(body))
                                        .getElement());
                    }
                    sig.addDocument("#" + setWsuId(body), transforms);
                }
View Full Code Here

      canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM, canonAlgo);

      if (wssConfig.isWsiBSPCompliant()) {
        Set prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false);

        InclusiveNamespaces inclusiveNamespaces = new InclusiveNamespaces(
            doc, prefixes);

        canonElem.appendChild(inclusiveNamespaces.getElement());
      }

      try {
        SignatureAlgorithm signatureAlgorithm = new SignatureAlgorithm(
            doc, sigAlgo);
View Full Code Here

TOP

Related Classes of org.apache.xml.security.transforms.params.InclusiveNamespaces

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.