Examples of InclusiveNamespaces


Examples of org.apache.xml.security.binding.excc14n.InclusiveNamespaces

        CanonicalizationMethodType canonicalizationMethodType = signatureType.getSignedInfo().getCanonicalizationMethod();
        if (!WSSConstants.NS_C14N_EXCL.equals(canonicalizationMethodType.getAlgorithm())) {
            securityContext.handleBSPRule(BSPRule.R5404);
        }

        InclusiveNamespaces inclusiveNamespacesType = XMLSecurityUtils.getQNameType(canonicalizationMethodType.getContent(),
                WSSConstants.TAG_c14nExcl_InclusiveNamespaces);
        if (inclusiveNamespacesType != null && inclusiveNamespacesType.getPrefixList().size() == 0) {
            securityContext.handleBSPRule(BSPRule.R5406);
        }
    }
View Full Code Here

Examples of org.apache.xml.security.binding.excc14n.InclusiveNamespaces

                                && !WSSConstants.SOAPMESSAGE_NS10_STRTransform.equals(algorithm)
                                && !WSSConstants.SWA_ATTACHMENT_CONTENT_SIG_TRANS.equals(algorithm)
                                && !WSSConstants.SWA_ATTACHMENT_COMPLETE_SIG_TRANS.equals(algorithm)) {
                            securityContext.handleBSPRule(BSPRule.R5412);
                        }
                        InclusiveNamespaces inclusiveNamespacesType = XMLSecurityUtils.getQNameType(transformType.getContent(), XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces);
                        if (WSSConstants.NS_C14N_EXCL.equals(algorithm)
                                && inclusiveNamespacesType != null
                                && inclusiveNamespacesType.getPrefixList().size() == 0) {
                            securityContext.handleBSPRule(BSPRule.R5407);
                        }
                        if (WSSConstants.SOAPMESSAGE_NS10_STRTransform.equals(algorithm)) {
                            if (inclusiveNamespacesType != null
                                    && inclusiveNamespacesType.getPrefixList().size() == 0) {
                                securityContext.handleBSPRule(BSPRule.R5413);
                            }
                            TransformationParametersType transformationParametersType =
                                    XMLSecurityUtils.getQNameType(transformType.getContent(), WSSConstants.TAG_wsse_TransformationParameters);
                            if (transformationParametersType == null) {
View Full Code Here

Examples of org.apache.xml.security.binding.excc14n.InclusiveNamespaces

            if (transformationParametersType != null) {
                CanonicalizationMethodType canonicalizationMethodType =
                        XMLSecurityUtils.getQNameType(transformationParametersType.getAny(), WSSConstants.TAG_dsig_CanonicalizationMethod);
                if (canonicalizationMethodType != null) {

                    InclusiveNamespaces inclusiveNamespacesType =
                            XMLSecurityUtils.getQNameType(canonicalizationMethodType.getContent(), XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces);
                    List<String> inclusiveNamespaces = inclusiveNamespacesType != null ? inclusiveNamespacesType.getPrefixList() : null;
                    algorithm = canonicalizationMethodType.getAlgorithm();
                    parentTransformer = WSSUtils.getTransformer(inclusiveNamespaces, outputStream, algorithm, XMLSecurityConstants.DIRECTION.IN);
                }
            }
            algorithm = transformType.getAlgorithm();
            AlgorithmSuiteSecurityEvent algorithmSuiteSecurityEvent = new AlgorithmSuiteSecurityEvent();
            algorithmSuiteSecurityEvent.setAlgorithmURI(algorithm);
            algorithmSuiteSecurityEvent.setAlgorithmUsage(WSSConstants.C14n);
            algorithmSuiteSecurityEvent.setCorrelationID(referenceType.getId());
            inputProcessorChain.getSecurityContext().registerSecurityEvent(algorithmSuiteSecurityEvent);

            InclusiveNamespaces inclusiveNamespacesType = XMLSecurityUtils.getQNameType(transformType.getContent(), XMLSecurityConstants.TAG_c14nExcl_InclusiveNamespaces);
            List<String> inclusiveNamespaces = inclusiveNamespacesType != null ? inclusiveNamespacesType.getPrefixList() : null;

            if (parentTransformer != null) {
                parentTransformer = WSSUtils.getTransformer(parentTransformer, inclusiveNamespaces, algorithm, XMLSecurityConstants.DIRECTION.IN);
            } else {
                parentTransformer = WSSUtils.getTransformer(inclusiveNamespaces, outputStream, algorithm, XMLSecurityConstants.DIRECTION.IN);
View Full Code Here

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

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

                && 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

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

                       .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

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

      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

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

          }
          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

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

            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

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

                    }
                    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
TOP
Copyright © 2018 www.massapi.com. 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.