Uploaded image for project: 'WSS4J'
  1. WSS4J
  2. WSS-567

processSecurityHeadaers does not work for 1.1 namespace

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.4
    • 2.0.7, 2.1.5
    • WSS4J Core
    • None
    • windows 64

    Description

      I’m not sure why the WSS4J is not recognizing our messages. This is just testing the existing signature feature of our server with the new WSS4J 2.1.4. I’m still working on how to convince the software to expect the correct namespace.

      The two classes that define constants relative to 1.1 or 1.2 soap specification, which work correctly. The software believes this is a soap 1.1 message which is corrrrect. They are looking for the Security header element in the document which is present and valid.

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">
      <soap:Header>
      <wsse:BinarySecurityToken EncodingType="wsse:Base64Binary" Id="X509Token" ValueType="wsse:X509v3">
      MIICZTCCAc6gAwIBAgIWNDAzMjk4NzEyOTkxMDE3OTA4OTI3NzANBgkqhkiG9w0BAQUFADAeMRww
      … NulsPIzixDPpgKm8iPF1i8EEz/n3ByF2dKMMfn7Q5UgvXzjYOGsqwuwBXbzlPmpdW0DN4j6l/O0+
      djYJLdB/lvvj8kv9GfwLIlId5TejGtGVqCgUa7tzsOLBj0uvZpNBELA948iRYF4=
      </wsse:BinarySecurityToken>
      <wsse:Security>
      <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
      <SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
      <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>

      But they keep comparing the envelope namespace a different schema, where the below namespace which doesn’t match. So it cannot find the security header.

      public static final String WSSE_NS =
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";

      I believe the problem is in the WSSecurityUtil class method, getSecurityHeader where they choose the 1.2 namespace.

      public static Element getSecurityHeader(Document doc, String actor) throws WSSecurityException {
      Element soapHeaderElement = getSOAPHeader(doc);
      if (soapHeaderElement == null)

      { // no SOAP header at all return null; }

      String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
      return getSecurityHeader(soapHeaderElement, actor, WSConstants.URI_SOAP12_ENV.equals(soapNamespace));
      }

      and in WSSecurityUtil ... WSSE_NS is the 1.2 namespace.

      if (Node.ELEMENT_NODE == currentChild.getNodeType()
      && WSConstants.WSSE_LN.equals(currentChild.getLocalName())
      && WSConstants.WSSE_NS.equals(currentChild.getNamespaceURI())) {

      Attachments

        Activity

          People

            coheigea Colm O hEigeartaigh
            jeaton Jason Eaton
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: